From 5bc05558bb9f9acd1f895ea128f3326ef4b03338 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Tue, 17 Dec 2002 04:50:47 +0000 Subject: [PATCH] 2002-12-16 Roland McGrath * 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. --- strace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/strace.c b/strace.c index ec8d7527..67e832d3 100644 --- a/strace.c +++ b/strace.c @@ -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); -- 2.50.1