Trying again:

Fix wait4child change: Prefer wait3 over wait. Use SIGNAL instead of signal.
This commit is contained in:
Hallvard Furuseth 1999-04-02 04:12:18 +00:00
parent 815a62930c
commit 7d8e7085e3

View File

@ -312,23 +312,19 @@ static RETSIGTYPE
wait4child( int sig )
{
int save_errno = errno;
#ifdef WNOHANG
errno = 0;
/*
* ### The wait3 vs. waitpid choice needs improvement.
* ### There are apparently systems where waitpid(-1, ...) fails, and
* ### others where waitpid should preferred over wait3 for some reason.
* ### Now wait3 is only here for reference, configure does not detect it.
*/
#if defined(HAVE_WAITPID) && defined(WNOHANG)
#ifdef HAVE_WAITPID
while ( waitpid( (pid_t)-1, NULL, WNOHANG ) >= 0 || errno == EINTR )
; /* NULL */
#elif defined(HAVE_WAIT3) && defined(WNOHANG)
#else
while ( wait3( NULL, WNOHANG, NULL ) >= 0 || errno == EINTR )
; /* NULL */
#else
#endif
(void) wait( NULL );
#endif
(void) signal( sig, wait4child );
(void) SIGNAL( sig, wait4child );
errno = save_errno;
}