Skip to content

Commit f9d0bc2

Browse files
committed
Remove a useless check if fd is negative
If `slave` is negative, neither `dup2(slave,0)` or `close(slave)` should be executed. I believe this check is completely useless.
1 parent a32981b commit f9d0bc2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/pty/pty.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ obtain_ctty(int master, int slave, const char *slavename, char *errbuf, size_t e
180180
dup2(slave,0);
181181
dup2(slave,1);
182182
dup2(slave,2);
183-
if (slave < 0 || slave > 2) (void)!close(slave);
183+
if (slave > 2) (void)!close(slave);
184184
return 0;
185185
}
186186

0 commit comments

Comments
 (0)