I consider the following code of system(3).  pid is changed by return
value of _wait4().  I feel this need a correction.

        default:                        /* parent */
                do {
                        pid = _wait4(pid, &pstat, 0, (struct rusage *)0);
                } while (pid == -1 && errno == EINTR);
                break;

Please review and commit this patch.

Index: src/lib/libc/stdlib/system.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/stdlib/system.c,v
retrieving revision 1.7
diff -u -r1.7 system.c
--- src/lib/libc/stdlib/system.c        2001/01/24 13:00:59     1.7
+++ src/lib/libc/stdlib/system.c        2001/09/29 08:53:14
@@ -86,9 +86,9 @@
                execl(_PATH_BSHELL, "sh", "-c", command, (char *)NULL);
                _exit(127);
        default:                        /* parent */
-               do {
-                       pid = _wait4(pid, &pstat, 0, (struct rusage *)0);
-               } while (pid == -1 && errno == EINTR);
+               while (_wait4(pid, &pstat, 0, (struct rusage *)0) == -1 &&
+                      errno == EINTR)
+                       ;       /* nothing */
                break;
        }
        (void)_sigaction(SIGINT, &intact, NULL);
--
Toshihiko ARAI

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to