From d844170c26480de393a7ced6b95de7730ac3f75f Mon Sep 17 00:00:00 2001 From: janw Date: Mon, 14 Jan 2008 13:45:10 +0000 Subject: [PATCH] Daemon improvements. Removed STD* mappings. Writes PID file again. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8324 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/gosa-si-bus | 6 +----- gosa-si/gosa-si-server | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/gosa-si/gosa-si-bus b/gosa-si/gosa-si-bus index bca785bfe..42f6cb70c 100755 --- a/gosa-si/gosa-si-bus +++ b/gosa-si/gosa-si-bus @@ -1265,11 +1265,7 @@ daemon_log("$0 started!", 1); # Just fork, if we"re not in foreground mode if( ! $foreground ) { chdir '/' or die "Can't chdir to /: $!"; - open STDIN, '/dev/null' or die "Can't read /dev/null: $!"; - open STDOUT, '>>/dev/null' or die "Can't write to /dev/null: $!"; - open STDERR, '>>/dev/null' or die "Can't write to /dev/null: $!"; - defined($pid = fork) or die "Can't fork: $!"; - exit if $pid; + $pid = fork; setsid or die "Can't start a new session: $!"; umask 0; } diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index 807f86a85..dfec2b882 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -920,11 +920,7 @@ daemon_log("$0 started!", 1); # Just fork, if we"re not in foreground mode if( ! $foreground ) { chdir '/' or die "Can't chdir to /: $!"; - open STDIN, '/dev/null' or die "Can't read /dev/null: $!"; - open STDOUT, '>>/dev/null' or die "Can't write to /dev/null: $!"; - open STDERR, '>>/dev/null' or die "Can't write to /dev/null: $!"; - defined($pid = fork) or die "Can't fork: $!"; - exit if $pid; + $pid = fork; setsid or die "Can't start a new session: $!"; umask 0; } else { -- 2.30.2