diff options
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/Ustar.pm')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Ustar.pm | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Ustar.pm b/usr.sbin/pkg_add/OpenBSD/Ustar.pm index a3cd7e6e810..0f4bfc98536 100644 --- a/usr.sbin/pkg_add/OpenBSD/Ustar.pm +++ b/usr.sbin/pkg_add/OpenBSD/Ustar.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Ustar.pm,v 1.17 2005/06/13 12:22:37 espie Exp $ +# $OpenBSD: Ustar.pm,v 1.18 2005/06/13 12:46:47 espie Exp $ # # Copyright (c) 2002-2004 Marc Espie <espie@openbsd.org> # @@ -205,8 +205,11 @@ sub prepare archive => $self, destdir => $self->{destdir} }; - - if (-l $_) { + my $k = $entry->{key}; + if (defined $self->{key}->{$k}) { + $entry->{linkname} = $self->{key}->{$k}; + bless "OpenBSD::Ustar::HardLink", $entry; + } elsif (-l $_) { $entry->{linkname} = readlink("$destdir/$filename"); bless "OpenBSD::Ustar::SoftLink", $entry; } elsif (-d _) { @@ -238,7 +241,8 @@ sub write my $self = shift; my $arc = $self->{archive}; - $self->write_header($arc); + my $header = OpenBSD::Ustar::mkheader($self, $self->type()); + syswrite($arc->{fh}, $header, 512); $self->write_contents($arc); my $k = $self->{key}; if (!defined $arc->{key}->{$k}) { @@ -251,13 +255,6 @@ sub write_contents # only files have anything to write } -sub write_header -{ - my ($self, $arc) = @_; - my $header = OpenBSD::Ustar::mkheader($self, $self->type()); - syswrite($arc->{fh}, $header, 512); -} - sub isDir() { 0 } sub isFile() { 0 } sub isLink() { 0 } @@ -409,17 +406,6 @@ sub create $self->SUPER::set_modes(); } -sub write_header -{ - my ($self, $arc) = @_; - my $k = $self->{key}; - if (defined $arc->{key}->{$k}) { - $self->{linkname} = $arc->{key}->{$k}; - bless "OpenBSD::Ustar::HardLink", $self; - } - $self->SUPER::write_header($arc); -} - sub write_contents { my ($self, $arc) = @_; |