Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Sep 2001 00:27:54 +0900 (JST)
From:      Toshihiko ARAI <toshi@jp.FreeBSD.org>
To:        freebsd-hackers@FreeBSD.org
Subject:   Doubt of system(3)
Message-ID:  <200109291527.f8TFRrU76727.toshi@jp.FreeBSD.org>

next in thread | raw e-mail | index | archive | help
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 majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200109291527.f8TFRrU76727.toshi>