summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2013-05-13 18:30:52 +0000
committerMarc Espie <espie@cvs.openbsd.org>2013-05-13 18:30:52 +0000
commit8d0ee943ac8415f9e4708da4b44a5bc5665a2724 (patch)
treec7d5e2fc4f64f38aaa2b688d5d45d7d96ee27af3 /usr.sbin/pkg_add
parentf46f89f3d10a896a1d22753d493b7efc5c4bc9f8 (diff)
specialfiles ARE file while destated, so they set lastfile, which is
useful for size and digest. BUT samples should never alias specialfiles, so error out right away.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingElement.pm7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
index d1fde34f7ed..c36a36af676 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackingElement.pm,v 1.211 2013/02/18 20:24:11 okan Exp $
+# $OpenBSD: PackingElement.pm,v 1.212 2013/05/13 18:30:51 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -474,9 +474,14 @@ our @ISA=qw(OpenBSD::PackingElement::FileObject);
sub keyword() { "sample" }
sub absolute_okay() { 1 }
__PACKAGE__->register_with_factory;
+
sub destate
{
my ($self, $state) = @_;
+ if ($state->{lastfile}->isa("OpenBSD::PackingElement::SpecialFile")) {
+ die "Can't \@sample a specialfile: ".
+ $state->{lastfile}->stringize. "\n";
+ }
$self->{copyfrom} = $state->{lastfile};
$self->compute_fullname($state);
$self->compute_modes($state);