aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorRick Reed <[email protected]>2012-12-13 10:13:53 -0800
committerAnthony Ramine <[email protected]>2014-03-09 12:32:56 +0100
commita2820c8db97c05d4fc11e04048c123e1da24da88 (patch)
tree8cc442f3da32818e3f0cee926576b3500d8248f8 /erts/emulator
parent870737ab657433c5e8751255fe3c4d298202d142 (diff)
downloadotp-a2820c8db97c05d4fc11e04048c123e1da24da88.tar.gz
otp-a2820c8db97c05d4fc11e04048c123e1da24da88.tar.bz2
otp-a2820c8db97c05d4fc11e04048c123e1da24da88.zip
Use closefrom(2) when available in child_setup
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/sys/unix/erl_child_setup.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/erts/emulator/sys/unix/erl_child_setup.c b/erts/emulator/sys/unix/erl_child_setup.c
index 7c6e4a2f37..99d2b2a739 100644
--- a/erts/emulator/sys/unix/erl_child_setup.c
+++ b/erts/emulator/sys/unix/erl_child_setup.c
@@ -89,8 +89,12 @@ main(int argc, char *argv[])
if (sscanf(argv[CS_ARGV_FD_CR_IX], "%d:%d", &from, &to) != 2)
return 1;
+#if defined(HAVE_CLOSEFROM)
+ closefrom(from);
+#else
for (i = from; i <= to; i++)
(void) close(i);
+#endif
if (!(argv[CS_ARGV_WD_IX][0] == '.' && argv[CS_ARGV_WD_IX][1] == '\0')
&& chdir(argv[CS_ARGV_WD_IX]) < 0)