diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-12-14 10:32:03 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-12-14 11:06:00 +1000 |
commit | a40e0de9d1fac358c08153eba08de7cfa35421cd (patch) | |
tree | 710c22a69bd4116872bb228a307a02b545870f10 /src | |
parent | 47f7797011c7c4f9d7bc5d06837c4a7891941ac0 (diff) |
process: if the wait fails because the child is still running, reset errno
Prevent callers from getting odd errors if they notice the wait fails
because the child is still running and errno is still on whatever it was
before.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/process.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/process.cpp b/src/process.cpp index af8b0f8..9580569 100644 --- a/src/process.cpp +++ b/src/process.cpp @@ -176,8 +176,12 @@ bool xorg::testing::Process::WaitForExit(unsigned int timeout) { d_->state = FINISHED_FAILURE; } return true; - } else + } else { + /* prevent callers from getting odd erros if they check for errno */ + if (pid == 0) + errno = 0; return (pid == -1 && errno == ECHILD); + } } bool xorg::testing::Process::KillSelf(int signal, unsigned int timeout) { |