summaryrefslogtreecommitdiff
path: root/avserver.c
diff options
context:
space:
mode:
authorJanne Grunau <janne-libav@jannau.net>2012-10-25 14:54:48 +0200
committerJanne Grunau <janne-libav@jannau.net>2012-11-15 17:36:38 +0100
commita4cd2ad89aa67533ff69de49612c747825c3f96f (patch)
treec7fedd5fe7aae8c7c32175daa031f579856e48f4 /avserver.c
parentada51a334aeb1e378fe852c8b5eede9cbbd05f69 (diff)
downloadffmpeg-a4cd2ad89aa67533ff69de49612c747825c3f96f.tar.gz
avserver: use freopen to redirect stdin/out/err to /dev/null
Diffstat (limited to 'avserver.c')
-rw-r--r--avserver.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/avserver.c b/avserver.c
index 649cbedbab..9f6b9d9405 100644
--- a/avserver.c
+++ b/avserver.c
@@ -25,6 +25,7 @@
#endif
#include <string.h>
#include <stdlib.h>
+#include <stdio.h>
#include "libavformat/avformat.h"
// FIXME those are internal headers, avserver _really_ shouldn't use them
#include "libavformat/ffm.h"
@@ -513,13 +514,12 @@ static void start_children(FFStream *feed)
close(i);
if (!avserver_debug) {
- i = open("/dev/null", O_RDWR);
- if (i != -1) {
- dup2(i, 0);
- dup2(i, 1);
- dup2(i, 2);
- close(i);
- }
+ if (!freopen("/dev/null", "r", stdin))
+ http_log("failed to redirect STDIN to /dev/null\n;");
+ if (!freopen("/dev/null", "w", stdout))
+ http_log("failed to redirect STDOUT to /dev/null\n;");
+ if (!freopen("/dev/null", "w", stderr))
+ http_log("failed to redirect STDERR to /dev/null\n;");
}
signal(SIGPIPE, SIG_DFL);