diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2005-09-13 09:30:56 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2005-09-13 09:30:56 +0000 |
commit | f986061e816ef447245fa37bf82e46b6f3a069cf (patch) | |
tree | f3874d31a856e276d51a096f8e024d70caa1c6d5 /usr.sbin/pkg_add/OpenBSD/Ustar.pm | |
parent | 80f0523bc1ea57dd89d0ddeb1269f8ab57ec3a80 (diff) |
allows grabbing a packing-list directly, without needing to go through
a temporary file, by using perl's new-fangled
open my $fh, '<', \$scalar
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/Ustar.pm')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Ustar.pm | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Ustar.pm b/usr.sbin/pkg_add/OpenBSD/Ustar.pm index 4ecbfc8fb4c..26a89209bec 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.35 2005/08/10 14:02:22 espie Exp $ +# $OpenBSD: Ustar.pm,v 1.36 2005/09/13 09:30:55 espie Exp $ # # Copyright (c) 2002-2004 Marc Espie <espie@openbsd.org> # @@ -599,6 +599,19 @@ sub create $self->SUPER::set_modes(); } +sub contents +{ + my $self = shift; + my $toread = $self->{size}; + my $buffer; + + if (!defined read($self->{archive}->{fh}, $buffer, $toread)) { + die "Error reading from archive: $!"; + } + $self->{archive}->{swallow} -= $toread; + return $buffer; +} + sub write_contents { my ($self, $arc) = @_; |