diff options
author | guenther <> | 2015-10-23 04:45:32 +0000 |
---|---|---|
committer | guenther <> | 2015-10-23 04:45:32 +0000 |
commit | b6f2ec11ea34dc6569ec111585aca9001e0bde41 (patch) | |
tree | 61b46d879ede5977526de447f9c770414910f6cd /src/lib | |
parent | 39d5aee63717e002ef61a78d0d84c18f07b53e91 (diff) | |
download | openbsd-b6f2ec11ea34dc6569ec111585aca9001e0bde41.tar.gz openbsd-b6f2ec11ea34dc6569ec111585aca9001e0bde41.tar.bz2 openbsd-b6f2ec11ea34dc6569ec111585aca9001e0bde41.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 'src/lib')
-rw-r--r-- | src/lib/libc/net/rcmdsh.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/libc/net/rcmdsh.c b/src/lib/libc/net/rcmdsh.c index ad3f79ecc5..a8cd0e60df 100644 --- a/src/lib/libc/net/rcmdsh.c +++ b/src/lib/libc/net/rcmdsh.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rcmdsh.c,v 1.15 2015/09/12 14:56:50 guenther Exp $ */ | 1 | /* $OpenBSD: rcmdsh.c,v 1.16 2015/10/23 04:45:32 guenther Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2001, MagniComp | 4 | * Copyright (c) 2001, MagniComp |
@@ -176,7 +176,8 @@ rcmdsh(char **ahost, int rport, const char *locuser, const char *remuser, | |||
176 | /* Parent. close sp[1], return sp[0]. */ | 176 | /* Parent. close sp[1], return sp[0]. */ |
177 | (void) close(sp[1]); | 177 | (void) close(sp[1]); |
178 | /* Reap child. */ | 178 | /* Reap child. */ |
179 | (void) wait(NULL); | 179 | while (waitpid(cpid, NULL, 0) == -1 && errno == EINTR) |
180 | ; | ||
180 | return(sp[0]); | 181 | return(sp[0]); |
181 | } | 182 | } |
182 | /* NOTREACHED */ | 183 | /* NOTREACHED */ |