2014-01-25 15:10:50 +01:00
|
|
|
From 41e442fea26f20ceb815306777d36361575825cc Mon Sep 17 00:00:00 2001
|
|
|
|
From: Hannes Reinecke <hare@suse.de>
|
|
|
|
Date: Mon, 26 Aug 2013 13:05:01 +0200
|
|
|
|
Subject: Allow ping to be interrupted
|
|
|
|
|
|
|
|
Signed-off-by: Hannes Reinecke <hare@suse.de>
|
|
|
|
---
|
|
|
|
ping.c | 9 +++++++++
|
|
|
|
1 file changed, 9 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/ping.c b/ping.c
|
|
|
|
index 0357c3d..83a7aad 100644
|
|
|
|
--- a/ping.c
|
|
|
|
+++ b/ping.c
|
2015-12-03 02:18:20 +01:00
|
|
|
@@ -98,6 +98,7 @@
|
|
|
|
static unsigned short in_cksum(const unsigned short *addr, int len, unsigned short salt);
|
2013-07-23 11:17:26 +02:00
|
|
|
static void pr_icmph(__u8 type, __u8 code, __u32 info, struct icmphdr *icp);
|
|
|
|
static int parsetos(char *str);
|
|
|
|
+static void doexit (int);
|
|
|
|
|
|
|
|
static struct {
|
|
|
|
struct cmsghdr cm;
|
2015-12-03 02:18:20 +01:00
|
|
|
@@ -504,6 +516,8 @@
|
2013-07-23 11:17:26 +02:00
|
|
|
options |= F_SOURCEROUTE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
+ set_signal(SIGINT, doexit);
|
|
|
|
+
|
|
|
|
while (argc > 0) {
|
|
|
|
target = *argv;
|
|
|
|
|
2015-12-03 02:18:20 +01:00
|
|
|
@@ -1629,3 +1643,9 @@
|
|
|
|
ping6_usage(1);
|
2013-07-23 11:17:26 +02:00
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+static void doexit(int signo)
|
|
|
|
+{
|
|
|
|
+ exit (1);
|
|
|
|
+}
|
|
|
|
+
|
2014-01-25 15:10:50 +01:00
|
|
|
--
|
|
|
|
1.8.1.4
|
|
|
|
|