mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-24 13:24:56 +08:00
ITS#6037: don't loop forever on EINTR in wait4child()
This commit is contained in:
parent
1e470657b2
commit
3e57c96acd
@ -1056,13 +1056,12 @@ wait4child( int sig )
|
|||||||
int save_errno = errno;
|
int save_errno = errno;
|
||||||
|
|
||||||
#ifdef WNOHANG
|
#ifdef WNOHANG
|
||||||
errno = 0;
|
do
|
||||||
|
errno = 0;
|
||||||
#ifdef HAVE_WAITPID
|
#ifdef HAVE_WAITPID
|
||||||
while ( waitpid( (pid_t)-1, NULL, WNOHANG ) > 0 || errno == EINTR )
|
while ( waitpid( (pid_t)-1, NULL, WNOHANG ) > 0 || errno == EINTR );
|
||||||
; /* NULL */
|
|
||||||
#else
|
#else
|
||||||
while ( wait3( NULL, WNOHANG, NULL ) > 0 || errno == EINTR )
|
while ( wait3( NULL, WNOHANG, NULL ) > 0 || errno == EINTR );
|
||||||
; /* NULL */
|
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
(void) wait( NULL );
|
(void) wait( NULL );
|
||||||
@ -1072,4 +1071,3 @@ wait4child( int sig )
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif /* LDAP_SIGCHLD */
|
#endif /* LDAP_SIGCHLD */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user