summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2004-11-06 12:22:34 +0000
committerMarc Espie <espie@cvs.openbsd.org>2004-11-06 12:22:34 +0000
commit1dfa48ced2a8f5d2d9655a7800267e4a20b7455f (patch)
tree80b7951c11fed5371765dfe444ef39445ea09a0b
parenta5a47c980c1fc5db77e66abaa47de74ac304b94c (diff)
die if moving tempfiles doesn't work.
pkg_delete should remove tempnames, since files actually live there.
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Add.pm5
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Delete.pm5
2 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm
index bb52e1f237f..89a21bf1260 100644
--- a/usr.sbin/pkg_add/OpenBSD/Add.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Add.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Add.pm,v 1.7 2004/11/06 12:20:02 espie Exp $
+# $OpenBSD: Add.pm,v 1.8 2004/11/06 12:22:33 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -169,7 +169,8 @@ sub install
} elsif (defined $self->{symlink}) {
symlink($self->{symlink}, $destdir.$fullname);
} else {
- rename($self->{tempname}, $destdir.$fullname);
+ rename($self->{tempname}, $destdir.$fullname) or
+ Fatal "Can't move file to $fullname: $!";
print "moving ", $self->{tempname}, " -> $destdir$fullname\n" if $state->{very_verbose};
undef $self->{tempname};
}
diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm
index b9980d51f2c..7d1ddcfd577 100644
--- a/usr.sbin/pkg_add/OpenBSD/Delete.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Delete.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Delete.pm,v 1.3 2004/11/01 19:14:26 espie Exp $
+# $OpenBSD: Delete.pm,v 1.4 2004/11/06 12:22:33 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -236,6 +236,9 @@ sub delete
{
my ($self, $state) = @_;
my $name = $self->fullname();
+ if (defined $self->{tempname}) {
+ $name = $self->{tempname};
+ }
my $realname = $state->{destdir}.$name;
if (-l $realname) {
if ($state->{beverbose}) {