Software /
code /
prosody
Changeset
5176:7d0a8b255a37
util.pposix: Prevent FDs 0, 1 and 2 from being assigned to connections
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 10 Nov 2012 23:41:53 +0100 |
parents | 5175:fabaed7418a6 |
children | 5177:add9ad38208e |
files | util-src/pposix.c |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/util-src/pposix.c Sat Nov 10 23:39:22 2012 +0100 +++ b/util-src/pposix.c Sat Nov 10 23:41:53 2012 +0100 @@ -89,6 +89,10 @@ 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())