diff --git a/src/gitolite.pm b/src/gitolite.pm index 1372d59..62c6791 100644 --- a/src/gitolite.pm +++ b/src/gitolite.pm @@ -101,9 +101,10 @@ sub wrap_open { sub wrap_print { my ($file, @text) = @_; - my $fh = wrap_open(">", $file); + my $fh = wrap_open(">", "$file.$$"); print $fh @text; close($fh) or die "$ABRT close $file failed: $! at ", (caller)[1], " line ", (caller)[2], "\n"; + rename "$file.$$", $file; } sub slurp { diff --git a/src/gl-compile-conf b/src/gl-compile-conf index 9799841..5d59358 100755 --- a/src/gl-compile-conf +++ b/src/gl-compile-conf @@ -560,11 +560,12 @@ for my $repo (@phy_repos) { # write out the project list, but not if GL_NO_DAEMON_NO_GITWEB is set unless ($GL_NO_DAEMON_NO_GITWEB) { - my $projlist_fh = wrap_open( ">", $PROJECTS_LIST); + my $projlist_fh = wrap_open( ">", "$PROJECTS_LIST.$$"); for my $proj (sort keys %projlist) { print $projlist_fh "$proj\n"; } close $projlist_fh; + rename "$PROJECTS_LIST.$$", $PROJECTS_LIST; } # ----------------------------------------------------------------------------