File iputils-s20101006-sec-ping-unblock.diff of Package iputils.38678

From bf83678619dd0286f7a66f2ab02763751b0e8ca9 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Mon, 26 Aug 2013 13:02:36 +0200
Subject: Block SIGALRM in ping.c
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

ping depends on SIGALRM to exit eventually, so we need to mask
it with UNBLOCK.

Signed-off-by: Marcus Schäfer <ms@suse.de>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 ping.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/ping.c b/ping.c
index 71b445d..0357c3d 100644
--- a/ping.c
+++ b/ping.c
@@ -139,6 +139,16 @@ main(int argc, char **argv)
 
 	enable_capability_raw();
 
+	/*
+	* ping depend on SIGALARM to exit sometimes,
+	* but to popen, system, fork carry on parent signal handler
+	* so we mask it ourself.
+	*/
+	sigset_t s;
+	sigaddset(&s, SIGALRM);
+	sigprocmask(SIG_UNBLOCK, &s, NULL);
+	set_signal(SIGALRM, doexit);
+
 	icmp_sock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
 	socket_errno = errno;
 
-- 
1.8.1.4

openSUSE Build Service is sponsored by