mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
When about to do an execve(), don't reset the O_NONBLOCK flag on any file
descriptors that have the close-on-exec flag set, as that will have no effect anyway and might screw something else up if the file descriptor happens to be shared with another process. PR: standards/43335 MFC after: 1 week
This commit is contained in:
parent
ac244ef31f
commit
e46cac58cd
1 changed files with 4 additions and 0 deletions
|
|
@ -69,6 +69,10 @@ _execve(const char *name, char *const * argv, char *const * envp)
|
|||
/* Check if this file descriptor is in use: */
|
||||
if (_thread_fd_table[i] != NULL &&
|
||||
(_thread_fd_getflags(i) & O_NONBLOCK) == 0) {
|
||||
/* Skip if the close-on-exec flag is set */
|
||||
flags = __sys_fcntl(i, F_GETFD, NULL);
|
||||
if ((flags & FD_CLOEXEC) != 0)
|
||||
continue; /* don't bother, no point */
|
||||
/* Get the current flags: */
|
||||
flags = __sys_fcntl(i, F_GETFL, NULL);
|
||||
/* Clear the nonblocking file descriptor flag: */
|
||||
|
|
|
|||
Loading…
Reference in a new issue