aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/m4
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2019-09-09 15:24:48 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2019-09-09 15:24:48 +0000
commitfdb905e20f6b3378b1905d7e7cacf807fc95867d (patch)
tree3dab80f7a5f11aa2abecd672ba3a56485a00212d /usr.bin/m4
parentd031bd192e6b987d6fa47dc00f5e5258bf3533e0 (diff)
downloadsrc-fdb905e20f6b3378b1905d7e7cacf807fc95867d.tar.gz
src-fdb905e20f6b3378b1905d7e7cacf807fc95867d.zip
m4: import patch from OpenBSD
Use waitpid()/EINTR idiom for the specific pid, rather than generic wait() Patch by: deraadt@ Obtained from: OpenBSD
Notes
Notes: svn path=/head/; revision=352067
Diffstat (limited to 'usr.bin/m4')
-rw-r--r--usr.bin/m4/gnum4.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/m4/gnum4.c b/usr.bin/m4/gnum4.c
index 905337151678..f09033786161 100644
--- a/usr.bin/m4/gnum4.c
+++ b/usr.bin/m4/gnum4.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gnum4.c,v 1.51 2017/06/15 13:48:42 bcallah Exp $ */
+/* $OpenBSD: gnum4.c,v 1.52 2017/08/21 21:41:13 deraadt Exp $ */
/*-
* SPDX-License-Identifier: BSD-2-Clause
@@ -634,7 +634,7 @@ void
doesyscmd(const char *cmd)
{
int p[2];
- pid_t pid, cpid;
+ pid_t cpid;
char *argv[4];
int cc;
int status;
@@ -672,8 +672,10 @@ doesyscmd(const char *cmd)
} while (cc > 0 || (cc == -1 && errno == EINTR));
(void) close(p[0]);
- while ((pid = wait(&status)) != cpid && pid >= 0)
- continue;
+ while (waitpid(cpid, &status, 0) == -1) {
+ if (errno != EINTR)
+ break;
+ }
pbstr(getstring());
}
}