summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFawzi Mohamed <fawzi.mohamed@digia.com>2013-06-24 16:41:28 +0200
committerFawzi Mohamed <fawzi.mohamed@digia.com>2013-06-25 13:48:06 +0200
commitbd5583eb9d14776edab426457939112f38580cd9 (patch)
treef3b7e9d84eeb21ec5ae862442af228271a1f7c38
parenta3cb35edbebf35b0bc1a89c9e274b6c5c7b428a8 (diff)
downloadqt-creator-bd5583eb9d14776edab426457939112f38580cd9.tar.gz
process_stub_unix: fix race condition with reading of env file
The stub incorrectly send its pid before reading the environment file, and qtcreator does interpret that as sign that it can delete the environment file. Task-number: QTCREATORBUG-9024 Change-Id: Id44777abdfdd94aa10815cb00ca27846b95a3ec7 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
-rw-r--r--src/libs/utils/process_stub_unix.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libs/utils/process_stub_unix.c b/src/libs/utils/process_stub_unix.c
index 7ab6a3e0bf..c561ce902c 100644
--- a/src/libs/utils/process_stub_unix.c
+++ b/src/libs/utils/process_stub_unix.c
@@ -198,8 +198,6 @@ int main(int argc, char *argv[])
isDebug = !strcmp(argv[ArgAction], "debug");
isDetached = 0;
- sendMsg("spid %ld\n", (long)getpid());
-
if (*argv[ArgDir] && chdir(argv[ArgDir])) {
/* Only expected error: no such file or direcotry */
sendMsg("err:chdir %d\n", errno);
@@ -235,6 +233,8 @@ int main(int argc, char *argv[])
env[count] = 0;
}
+ /* send our pid after we read the environment file (creator will get rid of it) */
+ sendMsg("spid %ld\n", (long)getpid());
/*
* set up the signal handlers