Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/ping handle the first loop where time == 0.



details:   https://anonhg.NetBSD.org/src/rev/3884d7269ed6
branches:  trunk
changeset: 768570:3884d7269ed6
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Aug 21 06:39:09 2011 +0000

description:
handle the first loop where time == 0.

diffstat:

 sbin/ping/ping.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 79ed37f2787d -r 3884d7269ed6 sbin/ping/ping.c
--- a/sbin/ping/ping.c  Sat Aug 20 22:23:47 2011 +0000
+++ b/sbin/ping/ping.c  Sun Aug 21 06:39:09 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ping.c,v 1.96 2011/08/20 14:38:09 christos Exp $       */
+/*     $NetBSD: ping.c,v 1.97 2011/08/21 06:39:09 christos Exp $       */
 
 /*
  * Copyright (c) 1989, 1993
@@ -58,7 +58,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ping.c,v 1.96 2011/08/20 14:38:09 christos Exp $");
+__RCSID("$NetBSD: ping.c,v 1.97 2011/08/21 06:39:09 christos Exp $");
 #endif
 
 #include <stdio.h>
@@ -1242,6 +1242,8 @@
 diffsec(struct timeval *timenow,
        struct timeval *then)
 {
+       if (timenow->tv_sec == 0)
+               return -1;
        return ((int32_t)((uint32_t)timenow->tv_sec - (uint32_t)then->tv_sec)
            * 1.0 + (timenow->tv_usec - then->tv_usec)/1000000.0);
 }



Home | Main Index | Thread Index | Old Index