aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/sys/unix
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2015-01-27 15:32:17 +0100
committerBjörn-Egil Dahlberg <[email protected]>2015-01-27 15:32:17 +0100
commit043ad57d27f7f320043c48c0a8dadfc86c797ff0 (patch)
treeb319ffaaeade92f66469832e5c6b9cd42443e5c9 /erts/emulator/sys/unix
parentaf87b1c3d4897840d8247589a88d3611106ecedc (diff)
downloadotp-043ad57d27f7f320043c48c0a8dadfc86c797ff0.tar.gz
otp-043ad57d27f7f320043c48c0a8dadfc86c797ff0.tar.bz2
otp-043ad57d27f7f320043c48c0a8dadfc86c797ff0.zip
erts: Don't close all fds twice in child_setup
The commit c2b4eab25c907f453a394d382c04cd04e6c06b49 introduced an error in which child_setup erroneously tried to close all file descriptors twice.
Diffstat (limited to 'erts/emulator/sys/unix')
-rw-r--r--erts/emulator/sys/unix/erl_child_setup.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/erts/emulator/sys/unix/erl_child_setup.c b/erts/emulator/sys/unix/erl_child_setup.c
index 94eb6b1547..5ad92dad02 100644
--- a/erts/emulator/sys/unix/erl_child_setup.c
+++ b/erts/emulator/sys/unix/erl_child_setup.c
@@ -101,7 +101,9 @@ main(int argc, char *argv[])
if (sscanf(argv[CS_ARGV_FD_CR_IX], "%d:%d", &from, &to) != 2)
return 1;
-#if defined(__ANDROID__)
+#if defined(HAVE_CLOSEFROM)
+ closefrom(from);
+#elif defined(__ANDROID__)
for (i = from; i <= to; i++) {
if (i!=__system_properties_fd)
(void) close(i);
@@ -109,13 +111,6 @@ main(int argc, char *argv[])
#else
for (i = from; i <= to; i++)
(void) close(i);
-#endif /* __ANDROID__ */
-
-#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')
@@ -147,8 +142,6 @@ main(int argc, char *argv[])
return 1;
}
-
-
#if defined(__ANDROID__)
int __system_properties_fd(void)
{