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 <[email protected]> --- src/process.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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) { -- 1.8.0.2 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
