diff options
author | Yusuke Endoh <[email protected]> | 2024-11-29 11:41:49 +0900 |
---|---|---|
committer | Yusuke Endoh <[email protected]> | 2024-11-29 12:38:20 +0900 |
commit | f9d0bc22f5ca019f3c517b42ea4a50867fe56700 (patch) | |
tree | 9104a1372a215402d502e5da08e471e1324bd1d1 | |
parent | a32981b6b89c23c7b650c6b1d1309e86856735ff (diff) |
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.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12207
-rw-r--r-- | ext/pty/pty.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/pty/pty.c b/ext/pty/pty.c index 725589a8ea..7c79f81e33 100644 --- a/ext/pty/pty.c +++ b/ext/pty/pty.c @@ -180,7 +180,7 @@ obtain_ctty(int master, int slave, const char *slavename, char *errbuf, size_t e dup2(slave,0); dup2(slave,1); dup2(slave,2); - if (slave < 0 || slave > 2) (void)!close(slave); + if (slave > 2) (void)!close(slave); return 0; } |