summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/scripts/webserver.pl13
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;