summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2004-11-12 23:26:42 +0000
committerMarc Espie <espie@cvs.openbsd.org>2004-11-12 23:26:42 +0000
commit386460bb492b5599883ca715680c00e5fa338565 (patch)
tree9ad15fce17a313d1ee0a166f4b1b524fdc2b8988 /usr.sbin
parentfb2679a1bd3a7946d8cc733d8412c710cf416237 (diff)
store a ref to cwd instead of cwd itself, allowing it to be shared.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingElement.pm11
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingList.pm5
2 files changed, 9 insertions, 7 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
index 8861c9d6516..4c580d232ba 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.67 2004/11/12 23:00:46 espie Exp $
+# $OpenBSD: PackingElement.pm,v 1.68 2004/11/12 23:26:41 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -167,8 +167,8 @@ sub fullname($)
{
my $self = $_[0];
my $fullname = $self->{name};
- if ($fullname !~ m|^/| && $self->{cwd} ne '.') {
- $fullname = $self->{cwd}."/".$fullname;
+ if ($fullname !~ m|^/| && ${$self->{cwd}} ne '.') {
+ $fullname = ${$self->{cwd}}."/".$fullname;
}
return $fullname;
}
@@ -834,7 +834,8 @@ sub keyword() { 'cwd' }
sub destate
{
my ($self, $state) = @_;
- $state->{cwd} = File::Spec->canonpath($self->{name});
+ my $name = File::Spec->canonpath($self->{name});
+ $state->{cwd} = \$name;
}
package OpenBSD::PackingElement::EndFake;
@@ -941,7 +942,7 @@ sub expand
}
if (m/\%D/) {
die "Bad expand" unless defined $state->{cwd};
- s/\%D/$state->{cwd}/g;
+ s/\%D/${$state->{cwd}}/g;
}
if (m/\%B/) {
die "Bad expand" unless defined $state->{lastfile};
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm
index 966456e1f32..b144a3c9e9c 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackingList.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackingList.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackingList.pm,v 1.34 2004/11/11 15:32:28 espie Exp $
+# $OpenBSD: PackingList.pm,v 1.35 2004/11/12 23:26:41 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -25,11 +25,12 @@ use OpenBSD::PackageInfo;
sub new
{
my $class = shift;
+ my $o = '.';
bless {state =>
{default_owner=>'root',
default_group=>'bin',
default_mode=> 0444,
- cwd=>'.'} }, $class;
+ cwd=>\$o} }, $class;
}
sub read