From: Roland McGrath Date: Sat, 18 Sep 1999 10:43:37 +0000 (+0000) Subject: 1999-09-18 Roland McGrath X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=38f795013c10ac30f349465aaf0c9312712186da;p=thirdparty%2Fglibc.git 1999-09-18 Roland McGrath * sysdeps/mach/hurd/wait4.c (__wait4): When proc_wait returns EAGAIN, return zero to indicate no children died yet (assuming WNOHANG). --- diff --git a/sysdeps/mach/hurd/wait4.c b/sysdeps/mach/hurd/wait4.c index 0b505ba0d8e..db6b8c021fa 100644 --- a/sysdeps/mach/hurd/wait4.c +++ b/sysdeps/mach/hurd/wait4.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 94, 95, 96, 97, 98 Free Software Foundation, Inc. +/* Copyright (C) 1993,94,95,96,97,98,99 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -35,8 +35,21 @@ __wait4 (pid_t pid, __WAIT_STATUS_DEFN stat_loc, int options, err = __USEPORT (PROC, __proc_wait (port, pid, options, stat_loc ?: &dummy, &sigcode, usage ?: &ignored, &dead)); - - return err ? (pid_t) __hurd_fail (err) : dead; + switch (err) + { + case 0: /* Got a child. */ + return dead; + case EAGAIN: + /* The RPC returns this error when the WNOHANG flag is set and no + selected children are dead (but some are living). In that + situation, our return value is zero. (The RPC can't return zero + for DEAD without also returning some garbage for the other out + parameters, so an error return is much more natural here. Hence + the difference between the RPC and the POSIX.1 interface. */ + return (pid_t) 0; + default: + return (pid_t) __hurd_fail (err); + } } weak_alias (__wait4, wait4)