Avoid file descriptor leak
`extra_fd` was leaked if `fd_set_cloexec` fails -- I can't think of any chance of that happening here, but just in case. Coverity Scan found this issue.
This commit is contained in:
parent
25602421fb
commit
c07fb79150
Notes:
git
2024-12-18 02:10:31 +00:00
@ -3368,6 +3368,7 @@ run_exec_dup2(VALUE ary, VALUE tmpbuf, struct rb_execarg *sargp, char *errmsg, s
|
||||
// in #assert_close_on_exec because the FD_CLOEXEC is not dup'd by default
|
||||
if (fd_get_cloexec(pairs[i].oldfd, errmsg, errmsg_buflen)) {
|
||||
if (fd_set_cloexec(extra_fd, errmsg, errmsg_buflen)) {
|
||||
close(extra_fd);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user