mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-09 02:52:04 +08:00
Trying again:
Fix wait4child change: Prefer wait3 over wait. Use SIGNAL instead of signal.
This commit is contained in:
parent
815a62930c
commit
7d8e7085e3
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user