Date: Sat, 12 Jul 1997 00:07:57 -0700 From: Sean Eric Fagan <sef@Kithrup.COM> To: julian@freebsd.org Cc: current@freebsd.org Subject: Re: I've broken ping Message-ID: <199707120707.AAA23391@kithrup.com>
next in thread | raw e-mail | index | archive | help
>(or if sean can post the patch someone else can check it in) >(to 2.2 and 3.0) (don;t you have commit privs sean?) Yeah, I have patches, but I was hoping you'd be able to test it more extensively than I could :). I can check it in tomorrow, otherwise. For the curious, the patches are below. I'm going to bed now :). Index: ping.c =================================================================== RCS file: /home/ncvs/src/sbin/ping/ping.c,v retrieving revision 1.23 diff -u -r1.23 ping.c --- ping.c 1997/07/09 20:33:58 1.23 +++ ping.c 1997/07/12 03:55:41 @@ -423,8 +423,19 @@ else (void)printf("PING %s: %d data bytes\n", hostname, datalen); - (void)signal(SIGINT, stopit); - (void)signal(SIGALRM, catcher); + si_sa.sa_handler = stopit; + sigemptyset(&si_sa.sa_mask); + si_sa.sa_flags = 0; + if (sigaction(SIGINT, &si_sa, 0) == -1) { + err(EX_OSERR, "sigaction SIGINT"); + } + + si_sa.sa_handler = catcher; + sigemptyset(&si_sa.sa_mask); + si_sa.sa_flags = 0; + if (sigaction(SIGALRM, &si_sa, 0) == -1) { + err(EX_OSERR, "sigaction SIGALRM"); + } /* * Use sigaction instead of signal() to get unambiguous semantics @@ -508,9 +519,17 @@ catcher(int sig) { int waittime; + struct sigaction si_sa; pinger(); - (void)signal(SIGALRM, catcher); + + si_sa.sa_handler = catcher; + sigemptyset(&si_sa.sa_mask); + si_sa.sa_flags = 0; + if (sigaction(SIGALRM, &si_sa, 0) == -1) { + err(EX_OSERR, "sigaction"); + } + if (!npackets || ntransmitted < npackets) alarm((u_int)interval); else { @@ -520,7 +539,9 @@ waittime = 1; } else waittime = MAXWAIT; - (void)signal(SIGALRM, stopit); + finish_up = 1; + si_sa.sa_handler = stopit; + (void)sigaction(SIGALRM, &si_sa, 0); (void)alarm((u_int)waittime); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199707120707.AAA23391>