diff --git a/servers/slapd/main.c b/servers/slapd/main.c index 6c06c02799..c37b0031b7 100644 --- a/servers/slapd/main.c +++ b/servers/slapd/main.c @@ -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; }