summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2009-11-03 09:57:28 +0000
committerMarc Espie <espie@cvs.openbsd.org>2009-11-03 09:57:28 +0000
commitd9f4e3de45322531f6197de28755adb5f2405de0 (patch)
tree6a0d3ea35182d39ef118aa2016ed8a2005ca75a5 /usr.sbin/pkg_add
parent05f9480d3b86102791743ed7da445c751f4960d4 (diff)
catch signals while we're doing something, so that cleanup always happens.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/pkg_delete9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/pkg_delete b/usr.sbin/pkg_add/pkg_delete
index e39c624ae0a..ebedd89e4e9 100644
--- a/usr.sbin/pkg_add/pkg_delete
+++ b/usr.sbin/pkg_add/pkg_delete
@@ -1,6 +1,6 @@
#!/usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_delete,v 1.113 2008/03/08 12:07:45 espie Exp $
+# $OpenBSD: pkg_delete,v 1.114 2009/11/03 09:57:27 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -158,6 +158,13 @@ if ($bad) {
exit(1);
}
+my $handler = sub { my $sig = shift; die "Caught SIG$sig"; };
+local $SIG{'INT'} = $handler;
+local $SIG{'QUIT'} = $handler;
+local $SIG{'HUP'} = $handler;
+local $SIG{'KILL'} = $handler;
+local $SIG{'TERM'} = $handler;
+
eval {
# and finally, handle the removal
{ do {