summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2006-03-07 14:18:52 +0000
committerMarc Espie <espie@cvs.openbsd.org>2006-03-07 14:18:52 +0000
commit57040c624d95cac73018ab0c16076d8f4fc5f28e (patch)
treeeda74a8dcb4ada195d507e9d2887703d853cf981 /usr.sbin/pkg_add
parentacff5bd259afcdf86938fa7d9d2865c823da2cbc (diff)
properly zap temporary file.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageRepository.pm3
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm7
2 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
index 97de9b5e990..b0f6810056c 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackageRepository.pm,v 1.6 2006/03/07 14:00:21 espie Exp $
+# $OpenBSD: PackageRepository.pm,v 1.7 2006/03/07 14:18:51 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -362,6 +362,7 @@ sub pkg_copy
my ($copy, $filename) = File::Temp::tempfile($template,
DIR => $dir) or die "Can't write copy to cache";
chmod 0644, $filename;
+ $object->{tempname] = $filename;
my $handler = sub {
my ($sig) = @_;
unlink $filename;
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm
index fbe09ebd058..febc41c95c4 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: SCP.pm,v 1.4 2006/03/07 14:00:48 espie Exp $
+# $OpenBSD: SCP.pm,v 1.5 2006/03/07 14:18:51 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -109,6 +109,9 @@ sub pkg_copy
$SIG{'USR1'} = sub {
close($in);
+ if (defined $object->{tempname}) {
+ unlink $object->{tempname};
+ }
kill USR1 => $object->{parent};
exit(1);
};
@@ -182,7 +185,7 @@ sub close
# XXX we have to make sure the grand-child is dead.
if (defined $object->{pid2}) {
my $received = 0;
- local $SIG{'USR1'} = sub { print STDERR "Received USR1\n"; $received = 1; };
+ local $SIG{'USR1'} = sub { $received = 1; };
kill USR1 => $object->{pid2};
while (!$received) {
sleep 0.01;