Software /
code /
prosody
Comparison
util-src/pposix.c @ 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 |
parent | 5068:14d4fc5859b9 |
child | 5359:43517e649c53 |
comparison
equal
deleted
inserted
replaced
5175:fabaed7418a6 | 5176:7d0a8b255a37 |
---|---|
87 | 87 |
88 /* Close stdin, stdout, stderr */ | 88 /* Close stdin, stdout, stderr */ |
89 close(0); | 89 close(0); |
90 close(1); | 90 close(1); |
91 close(2); | 91 close(2); |
92 /* Make sure accidental use of FDs 0, 1, 2 don't cause weirdness */ | |
93 open("/dev/null", O_RDONLY); | |
94 open("/dev/null", O_WRONLY); | |
95 open("/dev/null", O_WRONLY); | |
92 | 96 |
93 /* Final fork, use it wisely */ | 97 /* Final fork, use it wisely */ |
94 if(fork()) | 98 if(fork()) |
95 exit(0); | 99 exit(0); |
96 | 100 |