summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2019-07-24 09:03:12 +0000
committerespie <espie@openbsd.org>2019-07-24 09:03:12 +0000
commit500f0e869f8e2abee74eb90cff6155b287eba342 (patch)
tree8e8d94b97f28d96edd3c319fac2915db350b4602
parentRefactor the way RIBs are parsed a bit. No functional change but should (diff)
downloadwireguard-openbsd-500f0e869f8e2abee74eb90cff6155b287eba342.tar.xz
wireguard-openbsd-500f0e869f8e2abee74eb90cff6155b287eba342.zip
explain some details
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Error.pm12
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Temp.pm5
2 files changed, 15 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Error.pm b/usr.sbin/pkg_add/OpenBSD/Error.pm
index 31b68254a96..a44a9ceb982 100644
--- a/usr.sbin/pkg_add/OpenBSD/Error.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Error.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Error.pm,v 1.38 2019/07/22 06:59:41 espie Exp $
+# $OpenBSD: Error.pm,v 1.39 2019/07/24 09:03:12 espie Exp $
#
# Copyright (c) 2004-2010 Marc Espie <espie@openbsd.org>
#
@@ -42,6 +42,16 @@ sub cache(*&)
# get cleaned when the proper pid is used)
package OpenBSD::Handler;
+# a bunch of other modules create persistent state that must be cleaned up
+# on exit (temporary files, network connections to abort properly...)
+# END blocks would do that (but see below...) but sig handling bypasses that,
+# so we MUST install SIG handlers.
+
+# note that END will be run for *each* process, so beware!
+# (temp files are registered per pid, for instance, so they only
+# get cleaned when the proper pid is used)
+# hash of code to run on ANY exit
+
# hash of code to run on ANY exit
my $atend = {};
# hash of code to run on fatal signals
diff --git a/usr.sbin/pkg_add/OpenBSD/Temp.pm b/usr.sbin/pkg_add/OpenBSD/Temp.pm
index e650e949795..754bae9160b 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.37 2019/07/22 06:59:41 espie Exp $
+# $OpenBSD: Temp.pm,v 1.38 2019/07/24 09:03:12 espie Exp $
#
# Copyright (c) 2003-2005 Marc Espie <espie@openbsd.org>
#
@@ -26,6 +26,9 @@ use OpenBSD::Error;
our $tempbase = $ENV{'PKG_TMPDIR'} || OpenBSD::Paths->vartmp;
+# stuff that should be cleaned up on exit, registered by pid,
+# so that it gets cleaned on exit from the correct process
+
my $dirs = {};
my $files = {};