X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/58141a0ebcdf3313a83af712b83f8acd1c08aa3b..dcafcd015ddb992fc40194cac4977213c31fa108:/IkiWiki/UserInfo.pm diff --git a/IkiWiki/UserInfo.pm b/IkiWiki/UserInfo.pm index 115a263ce..02c27991c 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;