iputils/iputils-ss021109-ping-interrupt.diff

30 lines
659 B
Diff

--- ping.c 2008-08-18 11:19:05.000000000 +0200
+++ ping.c 2008-08-18 11:19:10.000000000 +0200
@@ -95,6 +95,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;
@@ -237,6 +238,8 @@
options |= F_SOURCEROUTE;
}
}
+ set_signal(SIGINT, doexit);
+
while (argc > 0) {
target = *argv;
@@ -1231,3 +1234,9 @@
" [ -T timestamp option ] [ -Q tos ] [hop1 ...] destination\n");
exit(2);
}
+
+static void doexit(int signo)
+{
+ exit (1);
+}
+