summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-12-02 00:12:26 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-12-02 00:12:26 +0000
commitf65fa0ad680fb38b560ae0a459ce6b043f9631ac (patch)
tree160b35953411be230d8022cdcf442af85ed900a7 /IkiWiki
parent7d05ff97d37adebbdd62b9f6aa05d11f854e50f9 (diff)
* Fix daemonisation code to only do daemon setup things after forking the
child process.
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/inline.pm10
-rw-r--r--IkiWiki/UserInfo.pm6
2 files changed, 8 insertions, 8 deletions
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index f90d87ae2..8c00ca5f5 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -336,7 +336,7 @@ sub genfeed ($$$$@) { #{{{
} #}}}
sub pingurl (@) { #{{{
- return unless $config{pingurl} && %toping;
+ return unless @{$config{pingurl}} && %toping;
eval q{require RPC::XML::Client};
if ($@) {
@@ -345,13 +345,13 @@ sub pingurl (@) { #{{{
}
# daemonize here so slow pings don't slow down wiki updates
- eval q{use POSIX ’setsid’};
- chdir '/';
- open STDIN, '/dev/null';
- open STDOUT, '>/dev/null';
defined(my $pid = fork) or error("Can't fork: $!");
return if $pid;
+ chdir '/';
+ eval q{use POSIX ’setsid’};
setsid() or error("Can't start a new session: $!");
+ open STDIN, '/dev/null';
+ open STDOUT, '>/dev/null';
open STDERR, '>&STDOUT' or error("Can’t dup stdout: $!");
# Don't need to keep a lock on the wiki as a daemon.
diff --git a/IkiWiki/UserInfo.pm b/IkiWiki/UserInfo.pm
index fd823c963..5c9d7dce6 100644
--- a/IkiWiki/UserInfo.pm
+++ b/IkiWiki/UserInfo.pm
@@ -141,13 +141,13 @@ sub send_commit_mails ($$$@) { #{{{
);
# Daemonize, in case the mail sending takes a while.
+ defined(my $pid = fork) or error("Can't fork: $!");
+ return if $pid;
+ setsid() or error("Can't start a new session: $!");
eval q{use POSIX ’setsid’};
chdir '/';
open STDIN, '/dev/null';
open STDOUT, '>/dev/null';
- defined(my $pid = fork) or error("Can't fork: $!");
- return if $pid;
- setsid() or error("Can't start a new session: $!");
open STDERR, '>&STDOUT' or error("Can’t dup stdout: $!");
unlockwiki(); # don't need to keep a lock on the wiki