Unified · Split
| @@ -25,6 +25,7 @@ · 24 unmodified lines | ||
| 25 | 25 | #endif |
| 26 | 26 | #include <string.h> |
| 27 | 27 | #include <stdlib.h> |
| 28 | +#include <stdio.h> | |
| 28 | 29 | #include "libavformat/avformat.h" |
| 29 | 30 | // FIXME those are internal headers, avserver _really_ shouldn't use them |
| 30 | 31 | #include "libavformat/ffm.h" |
| @@ -513,13 +514,12 @@ static void start_children(FFStream *feed) · 482 unmodified lines | ||
| 513 | 514 | close(i); |
| 514 | 515 | |
| 515 | 516 | if (!avserver_debug) { |
| 516 | − i = open("/dev/null", O_RDWR); | |
| 517 | − if (i != -1) { | |
| 518 | − dup2(i, 0); | |
| 519 | − dup2(i, 1); | |
| 520 | − dup2(i, 2); | |
| 521 | − close(i); | |
| 522 | − } | |
| 517 | + if (!freopen("/dev/null", "r", stdin)) | |
| 518 | + http_log("failed to redirect STDIN to /dev/null\n;"); | |
| 519 | + if (!freopen("/dev/null", "w", stdout)) | |
| 520 | + http_log("failed to redirect STDOUT to /dev/null\n;"); | |
| 521 | + if (!freopen("/dev/null", "w", stderr)) | |
| 522 | + http_log("failed to redirect STDERR to /dev/null\n;"); | |
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | signal(SIGPIPE, SIG_DFL); |