mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-07 13:30:03 -05:00
daemon: make sure pa has its own session and process group, but is not its leader so that we cannot acquire a tty ever
This commit is contained in:
parent
2dc37e1214
commit
8e94f65348
3 changed files with 38 additions and 20 deletions
|
|
@ -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
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue