diff options
| author | 2015-10-23 04:45:32 +0000 | |
|---|---|---|
| committer | 2015-10-23 04:45:32 +0000 | |
| commit | 5b6c92c3f1e5352dc287169ed8d7b85ed343b3da (patch) | |
| tree | bc75bd42754d8abf0a71e3db9a042ace54fb53b5 /lib/libc | |
| parent | Loop the waitpid() on EINTR, and save and restore the disposition of (diff) | |
| download | wireguard-openbsd-5b6c92c3f1e5352dc287169ed8d7b85ed343b3da.tar.xz wireguard-openbsd-5b6c92c3f1e5352dc287169ed8d7b85ed343b3da.zip | |
Use waitpid() instead of wait() to avoid returning early from another child
exiting, and loop the waitpid() on EINTR
ok deraadt@ millert@
Diffstat (limited to 'lib/libc')
| -rw-r--r-- | lib/libc/net/rcmdsh.c | 5 |
1 files 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 */ |
