From 4f2461c293f2c8f4fbc316ecab42d7339ca89118 Mon Sep 17 00:00:00 2001 From: espie Date: Mon, 18 May 2015 18:17:27 +0000 Subject: [PATCH] better error in case we can't create tempfiles --- usr.sbin/pkg_add/OpenBSD/Add.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm index a9fc006043c..d73dd244b6f 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.166 2015/05/18 10:41:19 espie Exp $ +# $OpenBSD: Add.pm,v 1.167 2015/05/18 18:17:27 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie # @@ -508,6 +508,10 @@ sub tie File::Path::mkpath($d); } my ($fh, $tempname) = OpenBSD::Temp::permanent_file($d, "pkg"); + if (!defined $tempname) { + $state->fatal("create temporary file in #1: #2", + $d, $!); + } $self->{tempname} = $tempname; my $src = $self->{tieto}->realname($state); @@ -540,6 +544,10 @@ sub extract File::Path::mkpath($d); } my ($fh, $tempname) = OpenBSD::Temp::permanent_file($d, "pkg"); + if (!defined $tempname) { + $state->fatal("create temporary file in #1: #2", + $d, $!); + } $self->{tempname} = $tempname; # XXX don't apply destdir twice -- 2.20.1