diff options
author | Erlang/OTP <[email protected]> | 2015-01-30 16:56:52 +0100 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2015-01-30 16:56:52 +0100 |
commit | 6bc8b0da4b1369201d1e229f4375f79cdcb2c594 (patch) | |
tree | adf87dbbf9ab0512fc01bd214b5f9b9a2aa2f02c /erts/emulator/sys/unix/sys.c | |
parent | 30e91c934635836ebe126b3444e73eb50b506ec0 (diff) | |
parent | 7e16e552e24859025e9029c9f24277596b59b3be (diff) | |
download | otp-6bc8b0da4b1369201d1e229f4375f79cdcb2c594.tar.gz otp-6bc8b0da4b1369201d1e229f4375f79cdcb2c594.tar.bz2 otp-6bc8b0da4b1369201d1e229f4375f79cdcb2c594.zip |
Merge branch 'egil/fix-child_setup-close/OTP-12446' into maint-17
* egil/fix-child_setup-close/OTP-12446:
erts: Use closefrom() if available when closing fds
erts: Don't close all fds twice in child_setup
Diffstat (limited to 'erts/emulator/sys/unix/sys.c')
-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 eff64b2c11..cd87b320e2 100644 --- a/erts/emulator/sys/unix/sys.c +++ b/erts/emulator/sys/unix/sys.c @@ -1560,9 +1560,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; |