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