mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
do mor daemonizing work
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@323 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
a370e6e763
commit
bc5b917f93
1 changed files with 11 additions and 0 deletions
11
polyp/main.c
11
polyp/main.c
|
|
@ -35,6 +35,7 @@
|
||||||
#include <memblock.h>
|
#include <memblock.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
#ifdef HAVE_LIBWRAP
|
#ifdef HAVE_LIBWRAP
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
|
@ -241,6 +242,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
if (conf->daemonize) {
|
if (conf->daemonize) {
|
||||||
pid_t child;
|
pid_t child;
|
||||||
|
int tty_fd;
|
||||||
|
|
||||||
if (pa_stdio_acquire() < 0) {
|
if (pa_stdio_acquire() < 0) {
|
||||||
pa_log(__FILE__": failed to acquire stdio.\n");
|
pa_log(__FILE__": failed to acquire stdio.\n");
|
||||||
|
|
@ -292,6 +294,15 @@ int main(int argc, char *argv[]) {
|
||||||
open("/dev/null", O_RDONLY);
|
open("/dev/null", O_RDONLY);
|
||||||
open("/dev/null", O_WRONLY);
|
open("/dev/null", O_WRONLY);
|
||||||
open("/dev/null", O_WRONLY);
|
open("/dev/null", O_WRONLY);
|
||||||
|
|
||||||
|
signal(SIGTTOU, SIG_IGN);
|
||||||
|
signal(SIGTTIN, SIG_IGN);
|
||||||
|
signal(SIGTSTP, SIG_IGN);
|
||||||
|
|
||||||
|
if ((tty_fd = open("/dev/tty", O_RDWR)) >= 0) {
|
||||||
|
ioctl(tty_fd, TIOCNOTTY, (char*) 0);
|
||||||
|
close(tty_fd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
chdir("/");
|
chdir("/");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue