2014-01-25 15:10:50 +01:00
|
|
|
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>
|
|
|
|
---
|
2018-07-04 00:02:17 +02:00
|
|
|
ping.c | 11 +++++++++++
|
|
|
|
1 file changed, 11 insertions(+)
|
|
|
|
|
2017-09-12 15:53:00 +02:00
|
|
|
diff --git a/ping.c b/ping.c
|
2019-05-24 19:12:38 +02:00
|
|
|
index 3debd82..06cc369 100644
|
2017-09-12 15:53:00 +02:00
|
|
|
--- a/ping.c
|
|
|
|
+++ b/ping.c
|
2019-05-24 19:12:38 +02:00
|
|
|
@@ -452,6 +452,17 @@ main(int argc, char **argv)
|
2014-01-25 15:10:50 +01:00
|
|
|
|
2015-12-03 02:18:20 +01:00
|
|
|
/* Create sockets */
|
2014-01-25 15:10:50 +01:00
|
|
|
enable_capability_raw();
|
2015-12-03 02:18:20 +01:00
|
|
|
+
|
2013-07-23 11:05:43 +02:00
|
|
|
+ /*
|
|
|
|
+ * 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);
|
|
|
|
+
|
2015-12-03 02:18:20 +01:00
|
|
|
if (hints.ai_family != AF_INET6)
|
2019-05-24 19:12:38 +02:00
|
|
|
create_socket(&sock4, AF_INET, hints.ai_socktype, IPPROTO_ICMP,
|
|
|
|
hints.ai_family == AF_INET);
|
2018-07-04 00:02:17 +02:00
|
|
|
--
|
|
|
|
2.17.1
|
|
|
|
|