diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2011-04-25 00:16:59 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2011-04-25 00:16:59 +0000 |
commit | 8a33acd96ada15d42b11fbcf18e5623b859b717e (patch) | |
tree | bcd9a2d4c063104cd968bed02fb507680fce57d1 /usr.sbin | |
parent | 9084a13d76f73b50978738d306c0b4270bb4e635 (diff) |
don't erase 1st manpage in case two manpages have the first name.
as noticed on texlive, among a host of other issues...
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PkgCreate.pm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm index 5fe2dec927e..8c3d4fcac07 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: PkgCreate.pm,v 1.43 2011/03/19 12:06:11 espie Exp $ +# $OpenBSD: PkgCreate.pm,v 1.44 2011/04/25 00:16:58 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -445,6 +445,13 @@ sub makesum_plist $state->{mandir} //= OpenBSD::Temp::permanent_dir( $ENV{TMPDIR} // '/tmp', "manpage"); my $tempname = $state->{mandir}."/".basename($dest); + if (-f $tempname) { + my $i = 0; + do { + $tempname = $state->{mandir}."/".$i.basename($dest); + $i++; + } while (-f $tempname); + } open my $fh, ">", $tempname or $state->error("can't create #1: #2", $tempname, $!); chmod 0444, $fh; |