summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2015-03-04 13:55:33 +0000
committerMarc Espie <espie@cvs.openbsd.org>2015-03-04 13:55:33 +0000
commit1f74d2b9b258be212a629f79eb9134951cb9d681 (patch)
tree5e5c747c0e6f06944371b8a7577ead80e8bb54a9 /usr.sbin
parent3a3bb405c333a0ac10968aa7491e22566dcd0b75 (diff)
better error reports if PKG_TMPDIR is not writable, okay millert@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageRepository.pm10
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Temp.pm6
2 files changed, 13 insertions, 3 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
index 8fcdbc94662..2850acad1d8 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.112 2015/02/03 10:26:29 espie Exp $
+# $OpenBSD: PackageRepository.pm,v 1.113 2015/03/04 13:55:32 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -521,6 +521,10 @@ sub open_pipe
my ($self, $object) = @_;
$object->{errors} = OpenBSD::Temp->file;
+ if (!defined $object->{errors}) {
+ $self->{state}->fatal("#1 not writable",
+ $OpenBSD::Temp::tempbase);
+ }
$object->{cache_dir} = $ENV{'PKG_CACHE'};
$object->{parent} = $$;
@@ -702,6 +706,10 @@ sub list
if (!defined $self->{list}) {
$self->make_room;
my $error = OpenBSD::Temp->file;
+ if (!defined $error) {
+ $self->{state}->fatal("#1 not writable",
+ $OpenBSD::Temp::tempbase);
+ }
$self->{list} = $self->obtain_list($error);
$self->parse_problems($error);
if ($self->{no_such_dir}) {
diff --git a/usr.sbin/pkg_add/OpenBSD/Temp.pm b/usr.sbin/pkg_add/OpenBSD/Temp.pm
index 1373f1ad015..76e59615044 100644
--- a/usr.sbin/pkg_add/OpenBSD/Temp.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Temp.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Temp.pm,v 1.26 2014/02/07 14:06:43 espie Exp $
+# $OpenBSD: Temp.pm,v 1.27 2015/03/04 13:55:32 espie Exp $
#
# Copyright (c) 2003-2005 Marc Espie <espie@openbsd.org>
#
@@ -77,7 +77,9 @@ sub file
local $SIG{'KILL'} = $h;
local $SIG{'TERM'} = $h;
($fh, $file) = permanent_file($tempbase, "pkgout");
- $files->{$file} = $$;
+ if (defined $file) {
+ $files->{$file} = $$;
+ }
}
if (defined $caught) {
kill $caught, $$;