Browse Source

[core] skip excess close() when FD_CLOEXEC defined

do not run through close() loop after fork() and before execve()
when FD_CLOEXEC is defined
personal/stbuehler/ci-build
Glenn Strauss 2 years ago
parent
commit
95b2774863
  1. 2
      src/fdevent.c

2
src/fdevent.c

@ -742,7 +742,7 @@ pid_t fdevent_fork_execve(const char *name, char *argv[], char *envp[], int fdin
}
if (0 != fdevent_set_stdin_stdout_stderr(fdin, fdout, fderr)) _exit(errno);
#ifdef FD_CLOEXEC
#ifndef FD_CLOEXEC
/*(might not be sufficient for open fds, but modern OS have FD_CLOEXEC)*/
for (int i = 3; i < 256; ++i) close(i);
#endif

Loading…
Cancel
Save