diff options
Diffstat (limited to '')
-rw-r--r-- | src/lib/libc/net/rcmdsh.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/libc/net/rcmdsh.c b/src/lib/libc/net/rcmdsh.c index b9cbd6d5d1..66caac3f3d 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.19 2016/05/28 15:46:00 millert Exp $ */ | 1 | /* $OpenBSD: rcmdsh.c,v 1.20 2019/06/28 13:32:42 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2001, MagniComp | 4 | * Copyright (c) 2001, MagniComp |
@@ -89,13 +89,13 @@ rcmdsh(char **ahost, int rport, const char *locuser, const char *remuser, | |||
89 | } | 89 | } |
90 | 90 | ||
91 | /* Get a socketpair we'll use for stdin and stdout. */ | 91 | /* Get a socketpair we'll use for stdin and stdout. */ |
92 | if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, sp) < 0) { | 92 | if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, sp) == -1) { |
93 | perror("rcmdsh: socketpair"); | 93 | perror("rcmdsh: socketpair"); |
94 | return(-1); | 94 | return(-1); |
95 | } | 95 | } |
96 | 96 | ||
97 | cpid = fork(); | 97 | cpid = fork(); |
98 | if (cpid < 0) { | 98 | if (cpid == -1) { |
99 | perror("rcmdsh: fork failed"); | 99 | perror("rcmdsh: fork failed"); |
100 | return(-1); | 100 | return(-1); |
101 | } else if (cpid == 0) { | 101 | } else if (cpid == 0) { |
@@ -103,13 +103,13 @@ rcmdsh(char **ahost, int rport, const char *locuser, const char *remuser, | |||
103 | * Child. We use sp[1] to be stdin/stdout, and close sp[0]. | 103 | * Child. We use sp[1] to be stdin/stdout, and close sp[0]. |
104 | */ | 104 | */ |
105 | (void) close(sp[0]); | 105 | (void) close(sp[0]); |
106 | if (dup2(sp[1], 0) < 0 || dup2(0, 1) < 0) { | 106 | if (dup2(sp[1], 0) == -1 || dup2(0, 1) == -1) { |
107 | perror("rcmdsh: dup2 failed"); | 107 | perror("rcmdsh: dup2 failed"); |
108 | _exit(255); | 108 | _exit(255); |
109 | } | 109 | } |
110 | /* Fork again to lose parent. */ | 110 | /* Fork again to lose parent. */ |
111 | cpid = fork(); | 111 | cpid = fork(); |
112 | if (cpid < 0) { | 112 | if (cpid == -1) { |
113 | perror("rcmdsh: fork to lose parent failed"); | 113 | perror("rcmdsh: fork to lose parent failed"); |
114 | _exit(255); | 114 | _exit(255); |
115 | } | 115 | } |