summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/core-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-10-31 02:43:47 +0100
committerLennart Poettering <lennart@poettering.net>2009-10-31 02:43:47 +0100
commit8e94f653489a0b3d549e61840a5cec711d466ab7 (patch)
treedb22dabf8983df98974f8d49da686a3b2bd41777 /src/pulsecore/core-util.c
parent2dc37e1214f20aab528ae680e9a85fc8ea143313 (diff)
daemon: make sure pa has its own session and process group, but is not its leader so that we cannot acquire a tty ever
Diffstat (limited to 'src/pulsecore/core-util.c')
-rw-r--r--src/pulsecore/core-util.c16
1 files changed, 16 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
+
+}