SHA256
1
0
forked from pool/iputils
iputils/iputils-s20101006-sec-ping-unblock.diff

20 lines
477 B
Diff
Raw Normal View History

--- ping.c 2013-07-23 11:02:26.364843595 +0200
+++ ping.c 2013-07-23 11:02:32.740900627 +0200
@@ -129,6 +129,16 @@
cap_t caps;
#endif
+ /*
+ * 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;