2002-12-16 Roland McGrath <roland@redhat.com>

* strace.c (trace) [LINUX]: Only check errno if wait4 actually fails,
	so we don't repeat a wait and thus drop a status.  Fixes RH#62591.
This commit is contained in:
Roland McGrath 2002-12-17 04:50:47 +00:00
parent 7ec1d3584b
commit 5bc05558bb

View File

@ -1679,14 +1679,14 @@ trace()
#ifdef LINUX
#ifdef __WALL
pid = wait4(-1, &status, wait4_options, cflag ? &ru : NULL);
if ((wait4_options & __WALL) && errno == EINVAL) {
if (pid < 0 && (wait4_options & __WALL) && errno == EINVAL) {
/* this kernel does not support __WALL */
wait4_options &= ~__WALL;
errno = 0;
pid = wait4(-1, &status, wait4_options,
cflag ? &ru : NULL);
}
if (!(wait4_options & __WALL) && errno == ECHILD) {
if (pid < 0 && !(wait4_options & __WALL) && errno == ECHILD) {
/* most likely a "cloned" process */
pid = wait4(-1, &status, __WCLONE,
cflag ? &ru : NULL);