diff options
author | Björn-Egil Dahlberg <[email protected]> | 2015-01-27 16:06:01 +0100 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2015-01-27 16:06:01 +0100 |
commit | 7e16e552e24859025e9029c9f24277596b59b3be (patch) | |
tree | a9d8313d6f497ded5b4343111a6157ef1276a483 /erts/emulator/sys | |
parent | 043ad57d27f7f320043c48c0a8dadfc86c797ff0 (diff) | |
download | otp-7e16e552e24859025e9029c9f24277596b59b3be.tar.gz otp-7e16e552e24859025e9029c9f24277596b59b3be.tar.bz2 otp-7e16e552e24859025e9029c9f24277596b59b3be.zip |
erts: Use closefrom() if available when closing fds
closefrom() was only used in the vfork() case before, now also
used in the fork() case.
Diffstat (limited to 'erts/emulator/sys')
-rw-r--r-- | erts/emulator/sys/unix/sys.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/erts/emulator/sys/unix/sys.c b/erts/emulator/sys/unix/sys.c index 0d677d5f34..ef38d3ecaa 100644 --- a/erts/emulator/sys/unix/sys.c +++ b/erts/emulator/sys/unix/sys.c @@ -1574,9 +1574,13 @@ static ErlDrvData spawn_start(ErlDrvPort port_num, char* name, SysDriverOpts* op goto child_error; } +#if defined(HAVE_CLOSEFROM) + closefrom(opts->use_stdio ? 3 : 5); +#else for (i = opts->use_stdio ? 3 : 5; i < max_files; i++) (void) close(i); - +#endif + if (opts->wd && chdir(opts->wd) < 0) goto child_error; |