summaryrefslogtreecommitdiffstats
path: root/src/pulsecore
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2009-11-02 18:09:57 +0100
committerDaniel Mack <daniel@caiaq.de>2009-11-02 18:09:57 +0100
commit21ffcd55a5a425870f8f4c3b4933bc7cb352e339 (patch)
tree0c403ccb610b7155e06b8eb0d48617c957e8effb /src/pulsecore
parentc4e276edbd84cbb8c5b594c9f427b0a25a7fb2ab (diff)
parent7938442f77fafbc6c14d5072d14b773b289dc809 (diff)
Merge branch 'master' of git://0pointer.de/pulseaudio
Diffstat (limited to 'src/pulsecore')
-rw-r--r--src/pulsecore/core-util.c16
-rw-r--r--src/pulsecore/core-util.h2
2 files changed, 18 insertions, 0 deletions
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 738bf065..2b0a60a8 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -2999,3 +2999,19 @@ finish:
pa_make_fd_cloexec(fileno(f));
return f;
}
+
+void pa_nullify_stdfds(void) {
+
+#ifndef OS_IS_WIN32
+ pa_close(STDIN_FILENO);
+ pa_close(STDOUT_FILENO);
+ pa_close(STDERR_FILENO);
+
+ pa_assert_se(open("/dev/null", O_RDONLY) == STDIN_FILENO);
+ pa_assert_se(open("/dev/null", O_WRONLY) == STDOUT_FILENO);
+ pa_assert_se(open("/dev/null", O_WRONLY) == STDERR_FILENO);
+#else
+ FreeConsole();
+#endif
+
+}
diff --git a/src/pulsecore/core-util.h b/src/pulsecore/core-util.h
index d50f79a2..9c9cf78a 100644
--- a/src/pulsecore/core-util.h
+++ b/src/pulsecore/core-util.h
@@ -265,4 +265,6 @@ int pa_pipe_cloexec(int pipefd[2]);
int pa_accept_cloexec(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
FILE* pa_fopen_cloexec(const char *path, const char *mode);
+void pa_nullify_stdfds(void);
+
#endif