aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorJohannes Weißl <[email protected]>2013-07-05 14:15:53 +0200
committerJohannes Weißl <[email protected]>2013-07-05 14:25:05 +0200
commit5e0c73fecc31c72f86663bec55819f093151a039 (patch)
tree5487cbe86a81e66a7e0d027e97c69728e3bc6a16 /erts
parent829eb3c3daf82be6777673e87d523ec977e9f196 (diff)
downloadotp-5e0c73fecc31c72f86663bec55819f093151a039.tar.gz
otp-5e0c73fecc31c72f86663bec55819f093151a039.tar.bz2
otp-5e0c73fecc31c72f86663bec55819f093151a039.zip
run_erl: Redirect standard streams to /dev/null
Like in epmd and erlexec. Otherwise "run_erl" fails on some platforms when called with the "-daemon" option, printing this error: "Cannot dup"
Diffstat (limited to 'erts')
-rw-r--r--erts/etc/unix/run_erl.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/erts/etc/unix/run_erl.c b/erts/etc/unix/run_erl.c
index 53c779b1be..b69e31f784 100644
--- a/erts/etc/unix/run_erl.c
+++ b/erts/etc/unix/run_erl.c
@@ -1142,6 +1142,14 @@ static void daemon_init(void)
sf_close(i);
}
+ /* Necessary on some platforms */
+
+ open("/dev/null", O_RDONLY); /* Order is important! */
+ open("/dev/null", O_WRONLY);
+ open("/dev/null", O_WRONLY);
+
+ errno = 0; /* if set by open */
+
OPEN_SYSLOG();
run_daemon = 1;
}