Date: Mon, 9 Sep 2019 15:24:49 +0000 (UTC) From: Baptiste Daroussin <bapt@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352067 - head/usr.bin/m4 Message-ID: <201909091524.x89FOnpC004655@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bapt Date: Mon Sep 9 15:24:48 2019 New Revision: 352067 URL: https://svnweb.freebsd.org/changeset/base/352067 Log: m4: import patch from OpenBSD Use waitpid()/EINTR idiom for the specific pid, rather than generic wait() Patch by: deraadt@ Obtained from: OpenBSD Modified: head/usr.bin/m4/gnum4.c Modified: head/usr.bin/m4/gnum4.c ============================================================================== --- head/usr.bin/m4/gnum4.c Mon Sep 9 15:20:19 2019 (r352066) +++ head/usr.bin/m4/gnum4.c Mon Sep 9 15:24:48 2019 (r352067) @@ -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()); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909091524.x89FOnpC004655>