From 5b6c92c3f1e5352dc287169ed8d7b85ed343b3da Mon Sep 17 00:00:00 2001 From: guenther Date: Fri, 23 Oct 2015 04:45:32 +0000 Subject: [PATCH] Use waitpid() instead of wait() to avoid returning early from another child exiting, and loop the waitpid() on EINTR ok deraadt@ millert@ --- lib/libc/net/rcmdsh.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/libc/net/rcmdsh.c b/lib/libc/net/rcmdsh.c index ad3f79ecc56..a8cd0e60df0 100644 --- a/lib/libc/net/rcmdsh.c +++ b/lib/libc/net/rcmdsh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcmdsh.c,v 1.15 2015/09/12 14:56:50 guenther Exp $ */ +/* $OpenBSD: rcmdsh.c,v 1.16 2015/10/23 04:45:32 guenther Exp $ */ /* * Copyright (c) 2001, MagniComp @@ -176,7 +176,8 @@ rcmdsh(char **ahost, int rport, const char *locuser, const char *remuser, /* Parent. close sp[1], return sp[0]. */ (void) close(sp[1]); /* Reap child. */ - (void) wait(NULL); + while (waitpid(cpid, NULL, 0) == -1 && errno == EINTR) + ; return(sp[0]); } /* NOTREACHED */ -- 2.20.1