[PATCH xorg-gtest 2/4] process: return if waitpid() fails

Peter Hutterer peter.hutterer at who-t.net
Mon Sep 24 17:34:54 PDT 2012


If the Process is forked after Start(), the child to be terminated isn't
actually the child and we hang forever. Thus, treat ECHILD as success, after
all if the child isn't there it can be seen as terminated.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/process.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/process.cpp b/src/process.cpp
index 284ecbd..57ee35e 100644
--- a/src/process.cpp
+++ b/src/process.cpp
@@ -133,6 +133,8 @@ bool xorg::testing::Process::WaitForExit(unsigned int timeout) {
 
     if (pid == Pid())
       return true;
+    else if (pid == -1)
+      return errno == ECHILD;
 
       usleep(10);
   }
-- 
1.7.11.2



More information about the xorg-devel mailing list