From: Hallvard B Furuseth Date: Thu, 8 Feb 1996 00:36:50 +0000 (+0100) Subject: installman patch: Dont remove manpages unless the new one is good X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6d64b06f7a33b9ca2cabcae3d8408ab3bbdfbf62;p=p5sagit%2Fp5-mst-13.2.git installman patch: Dont remove manpages unless the new one is good Fix 2 installman bugs: * If the old manpage existed, it was removed even if $pod2man failed. * If installman aborted, an incomplete manpage was left in $MANPATH. --- diff --git a/installman b/installman index 13cb75f..76ab23c 100755 --- a/installman +++ b/installman @@ -90,13 +90,15 @@ sub runpod2man { $manpage =~ s#\.p(m|od)$##; $manpage =~ s#/#::#g; $manpage = "${mandir}/${manpage}.${manext}"; - &cmd("$pod2man $mod > $manpage"); - if (-z $manpage) { - print STDERR "unlink $manpage\n"; - unless ($notify) { - unlink($manpage) || warn "cannot unlink $manpage: $!"; - } - } + &cmd("$pod2man $mod > $manpage.tmp"); + if (-s "$manpage.tmp") { + rename("$manpage.tmp", $manpage) && next; + warn "cannot rename to $manpage: $!"; + } + print STDERR "unlink $manpage.tmp\n"; + unless ($notify) { + unlink("$manpage.tmp") || warn "cannot unlink $manpage.tmp: $!"; + } } chdir "$builddir" || die "Unable to cd back to $builddir directory!\n$!\n"; }