From 100541ec40cecbc5963dbaa513ce8801836b995e Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Wed, 15 Jun 2011 02:42:53 +0000 Subject: [PATCH] waitpid(): Fixed regression introduced with my signals changes: When WNOHANG was specified the syscall error code B_WOULD_BLOCK would no longer be mapped to 0. Fixes #7693. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42188 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/libroot/posix/sys/wait.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/system/libroot/posix/sys/wait.cpp b/src/system/libroot/posix/sys/wait.cpp index 05fe759a1b..ce4beedf9f 100644 --- a/src/system/libroot/posix/sys/wait.cpp +++ b/src/system/libroot/posix/sys/wait.cpp @@ -32,8 +32,13 @@ waitpid(pid_t pid, int* _status, int options) pthread_testcancel(); - if (child < 0) + if (child < 0) { + // When not getting a child status when WNOHANG was specified, don't + // fail. + if (child == B_WOULD_BLOCK && (options & WNOHANG) != 0) + return 0; RETURN_AND_SET_ERRNO(child); + } // prepare the status if (_status != NULL) {