X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/8daaa11baa70e07f6405ccb4474e97cac9627961..62aecc19f0585779a443fead2fae23bf3483e44e:/IkiWiki/UserInfo.pm?ds=sidebyside diff --git a/IkiWiki/UserInfo.pm b/IkiWiki/UserInfo.pm index 267f5d9cd..99b3c9f0a 100644 --- a/IkiWiki/UserInfo.pm +++ b/IkiWiki/UserInfo.pm @@ -15,12 +15,19 @@ sub userinfo_retrieve () { #{{{ sub userinfo_store ($) { #{{{ my $userinfo=shift; + my $newfile="$config{wikistatedir}/userdb.new"; my $oldmask=umask(077); - my $ret=Storable::lock_store($userinfo, "$config{wikistatedir}/userdb"); + my $ret=Storable::lock_store($userinfo, $newfile); umask($oldmask); + if (defined $ret && $ret) { + if (! rename($newfile, "$config{wikistatedir}/userdb")) { + unlink($newfile); + $ret=undef; + } + } return $ret; } #}}} - + sub userinfo_get ($$) { #{{{ my $user=shift; my $field=shift; @@ -101,7 +108,7 @@ sub commit_notify_list ($@) { #{{{ length $userinfo->{$user}->{subscriptions} && exists $userinfo->{$user}->{email} && length $userinfo->{$user}->{email} && - grep { pagespec_match($_, $userinfo->{$user}->{subscriptions}) } @pages) { + grep { pagespec_match($_, $userinfo->{$user}->{subscriptions}, "") } @pages) { push @ret, $userinfo->{$user}->{email}; } } @@ -150,8 +157,8 @@ 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'}; + setsid() or error("Can't start a new session: $!"); chdir '/'; open STDIN, '/dev/null'; open STDOUT, '>/dev/null';