Commit a40e0de9 authored by Peter Hutterer's avatar Peter Hutterer
Browse files

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's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 47f77970
...@@ -176,8 +176,12 @@ bool xorg::testing::Process::WaitForExit(unsigned int timeout) { ...@@ -176,8 +176,12 @@ bool xorg::testing::Process::WaitForExit(unsigned int timeout) {
d_->state = FINISHED_FAILURE; d_->state = FINISHED_FAILURE;
} }
return true; 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); return (pid == -1 && errno == ECHILD);
}
} }
bool xorg::testing::Process::KillSelf(int signal, unsigned int timeout) { bool xorg::testing::Process::KillSelf(int signal, unsigned int timeout) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment