diff options
author | Michael Adam <obnox@samba.org> | 2009-09-10 10:25:57 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2009-09-10 11:08:08 +0200 |
commit | 449af292dc48b89e266c2a74c8110947c3db2ae2 (patch) | |
tree | 2c2f24d811630f15551cc5efa2579da42aa14d9a | |
parent | 526c70f6872ef46f96f4465c626338db3533cadc (diff) | |
download | tinyproxy-449af292dc48b89e266c2a74c8110947c3db2ae2.tar.gz tinyproxy-449af292dc48b89e266c2a74c8110947c3db2ae2.zip |
tests:webserver: reopen STDOUT/STDERR after locking pid file.
Michael
-rwxr-xr-x | tests/scripts/webserver.pl | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/scripts/webserver.pl b/tests/scripts/webserver.pl index a1d171d..ac029bd 100755 --- a/tests/scripts/webserver.pl +++ b/tests/scripts/webserver.pl @@ -154,10 +154,6 @@ sub daemonize() { chdir "/" or die "daemonize: can't chdir to /: $!"; open STDIN, "/dev/null" or die "daemonize: Can't read from /dev/null: $!"; - open STDOUT, ">> $access_log_file" or - die "daemonize: Can't write to '$access_log_file': $!"; - open STDERR, ">> $error_log_file" or - die "daemonize: Can't write to '$error_log_file': $!"; my $pid = fork(); die "daemonize: can't fork: $!" if not defined($pid); @@ -167,6 +163,13 @@ sub daemonize() { setsid or die "damonize: Can't create a new session: $!"; } +sub reopen_logs() { + open STDOUT, ">> $access_log_file" or + die "daemonize: Can't write to '$access_log_file': $!"; + open STDERR, ">> $error_log_file" or + die "daemonize: Can't write to '$error_log_file': $!"; +} + sub get_pid_lock() { open LOCKFILE, "> $pid_file" or die "Error opening pid-file $pid_file: $!"; @@ -191,8 +194,8 @@ $|=1; # autoflush process_options(); daemonize(); - get_pid_lock(); +reopen_logs(); $SIG{CHLD} = \&REAPER; |