fix spooler stdin

This commit is contained in:
roberto@voldemort
2010-08-05 12:21:34 +02:00
parent 67231da4a9
commit 2b5b0cf1bc
+14
View File
@@ -78,6 +78,9 @@ void spooler(struct uwsgi_server *uwsgi, PyObject * uwsgi_module_dict) {
int rlen = 0;
int datasize;
// prevent process blindly reading stdin to make mess
int nullfd;
struct uwsgi_header uh;
char *key;
@@ -114,6 +117,17 @@ void spooler(struct uwsgi_server *uwsgi, PyObject * uwsgi_module_dict) {
uwsgi_log( "lowering spooler priority to %d\n", PRIO_MAX);
setpriority(PRIO_PROCESS, getpid(), PRIO_MAX);
nullfd = open("/dev/null", O_RDONLY);
if (nullfd < 0) {
uwsgi_error("open()");
exit(1);
}
if (nullfd != 0) {
dup2(nullfd, 0);
close(nullfd);
}
for (;;) {
sleep(uwsgi->shared->spooler_frequency);