diff options
author | Johannes Weißl <[email protected]> | 2013-07-05 14:15:53 +0200 |
---|---|---|
committer | Johannes Weißl <[email protected]> | 2013-07-05 14:25:05 +0200 |
commit | 5e0c73fecc31c72f86663bec55819f093151a039 (patch) | |
tree | 5487cbe86a81e66a7e0d027e97c69728e3bc6a16 /erts/etc/unix | |
parent | 829eb3c3daf82be6777673e87d523ec977e9f196 (diff) | |
download | otp-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/etc/unix')
-rw-r--r-- | erts/etc/unix/run_erl.c | 8 |
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; } |