History

avserver: use freopen to redirect stdin/out/err to /dev/null

Janne Grunau committed 14 years ago

Commit a4cd2ad1 parent ada51a31 file · +7 −7Browse files

Unified · Split

avserver.c+7−7
@@ -25,6 +25,7 @@ · 24 unmodified lines
25#endif25#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 them30// 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);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t