iputils/iputils-s20101006-ping-interrupt.diff

30 lines
655 B
Diff

--- ping.c 2013-07-23 11:15:15.851715020 +0200
+++ ping.c 2013-07-23 11:15:28.075824028 +0200
@@ -103,6 +103,7 @@
static u_short in_cksum(const u_short *addr, int len, u_short salt);
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;
@@ -266,6 +267,8 @@
options |= F_SOURCEROUTE;
}
}
+ set_signal(SIGINT, doexit);
+
while (argc > 0) {
target = *argv;
@@ -1273,3 +1276,9 @@
" [-T tstamp-options] [-Q tos] [hop1 ...] destination\n");
exit(2);
}
+
+static void doexit(int signo)
+{
+ exit (1);
+}
+