diff options
author | Chad Loder <cloder@cvs.openbsd.org> | 2003-04-14 19:57:39 +0000 |
---|---|---|
committer | Chad Loder <cloder@cvs.openbsd.org> | 2003-04-14 19:57:39 +0000 |
commit | 8e3289b7724102e32825fc39f06af574fc8a3ced (patch) | |
tree | 1b4df3ff3ba0bac5952562b3bbdd8416a81c9f34 | |
parent | 29724d3e0ab184cb27a4782fcd55c5dad3f551d7 (diff) |
Defer incrementing ntransmitted until we are sure sendto succeeds.
-rw-r--r-- | sbin/ping/ping.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index c329ba61539..b0ef3e7ff95 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ping.c,v 1.58 2003/04/14 10:21:03 itojun Exp $ */ +/* $OpenBSD: ping.c,v 1.59 2003/04/14 19:57:38 cloder Exp $ */ /* $NetBSD: ping.c,v 1.20 1995/08/11 22:37:58 cgd Exp $ */ /* @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)ping.c 8.1 (Berkeley) 6/5/93"; #else -static char rcsid[] = "$OpenBSD: ping.c,v 1.58 2003/04/14 10:21:03 itojun Exp $"; +static char rcsid[] = "$OpenBSD: ping.c,v 1.59 2003/04/14 19:57:38 cloder Exp $"; #endif #endif /* not lint */ @@ -593,7 +593,7 @@ pinger(void) icp->icmp_type = ICMP_ECHO; icp->icmp_code = 0; icp->icmp_cksum = 0; - icp->icmp_seq = htons(ntransmitted++); + icp->icmp_seq = htons(ntransmitted); icp->icmp_id = ident; /* ID */ CLR(ntohs(icp->icmp_seq) % mx_dup_ck); @@ -634,6 +634,8 @@ pinger(void) } if (!(options & F_QUIET) && options & F_FLOOD) (void)write(STDOUT_FILENO, &DOT, 1); + + ntransmitted++; } /* |