improved uwsgi_run_command

This commit is contained in:
Roberto De Ioris
2012-12-10 15:10:52 +01:00
parent d24ad0e61c
commit 1447ae01bd
+21 -1
View File
@@ -3295,7 +3295,27 @@ pid_t uwsgi_run_command(char *command, int *stdin_fd, int stdout_fd) {
}
uwsgi_close_all_sockets();
uwsgi_close_all_fds();
//uwsgi_close_all_fds();
int i;
for (i = 3; i < (int) uwsgi.max_fd; i++) {
if (stdin_fd) {
if (i == stdin_fd[0] || i == stdin_fd[1]) {
continue;
}
}
if (stdout_fd > -1) {
if (i == stdout_fd) {
continue;
}
}
#ifdef __APPLE__
fcntl(i, F_SETFD, FD_CLOEXEC);
#else
close(i);
#endif
}
if (stdin_fd) {
close(stdin_fd[1]);