From 7d8e7085e31f6ef505ff61c2061f2467c411536b Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Fri, 2 Apr 1999 04:12:18 +0000 Subject: [PATCH] Trying again: Fix wait4child change: Prefer wait3 over wait. Use SIGNAL instead of signal. --- servers/slapd/main.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) 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; } -- 2.39.5