projects
/
prosody.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6c5cf2b
)
util.pposix: Prevent FDs 0, 1 and 2 from being assigned to connections
author
Kim Alvefur
<zash@zash.se>
Sat, 10 Nov 2012 22:41:53 +0000
(23:41 +0100)
committer
Kim Alvefur
<zash@zash.se>
Sat, 10 Nov 2012 22:41:53 +0000
(23:41 +0100)
util-src/pposix.c
patch
|
blob
|
history
diff --git
a/util-src/pposix.c
b/util-src/pposix.c
index 191e276ee1bc4576603feae2451924547bf5606d..05303d99ae574a2e1ab990f64d06d206e19fd11a 100644
(file)
--- a/
util-src/pposix.c
+++ b/
util-src/pposix.c
@@
-89,6
+89,10
@@
static int lc_daemonize(lua_State *L)
close(0);
close(1);
close(2);
+ /* Make sure accidental use of FDs 0, 1, 2 don't cause weirdness */
+ open("/dev/null", O_RDONLY);
+ open("/dev/null", O_WRONLY);
+ open("/dev/null", O_WRONLY);
/* Final fork, use it wisely */
if(fork())