[pve-devel] [PATCH librados2-perl 2/3] reset inherited signal handlers in child worker

Fiona Ebner f.ebner at proxmox.com
Tue Aug 8 13:23:11 CEST 2023


For example, if pvestatd is the parent, the inherited signal handlers
from pvestatd, i.e. PVE/Daemon.pm's handlers would be invoked by the
child.

Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
 PVE/RADOS.pm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/PVE/RADOS.pm b/PVE/RADOS.pm
index 162e7db..41b9c39 100644
--- a/PVE/RADOS.pm
+++ b/PVE/RADOS.pm
@@ -201,6 +201,11 @@ sub new {
 	    &$atfork();
 	}
 
+	# override signal handlers inherited from the parent
+	local $SIG{HUP} = $SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub {
+	    exit(1);
+	};
+
 	# fixme: timeout?
 
 	close $child;
-- 
2.39.2






More information about the pve-devel mailing list