Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/traceroute check if timeout already expired before ...



details:   https://anonhg.NetBSD.org/src/rev/2ae1d7db4b1b
branches:  trunk
changeset: 520464:2ae1d7db4b1b
user:      yamt <yamt%NetBSD.org@localhost>
date:      Sat Jan 12 02:42:58 2002 +0000

description:
check if timeout already expired before select.
from OpenBSD/FreeBSD.

diffstat:

 usr.sbin/traceroute/traceroute.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r 6825379a16d2 -r 2ae1d7db4b1b usr.sbin/traceroute/traceroute.c
--- a/usr.sbin/traceroute/traceroute.c  Sat Jan 12 02:25:32 2002 +0000
+++ b/usr.sbin/traceroute/traceroute.c  Sat Jan 12 02:42:58 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: traceroute.c,v 1.44 2001/11/04 23:14:35 atatat Exp $   */
+/*     $NetBSD: traceroute.c,v 1.45 2002/01/12 02:42:58 yamt Exp $     */
 
 /*
  * Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996, 1997
@@ -29,7 +29,7 @@
 #else
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996, 1997\n\
 The Regents of the University of California.  All rights reserved.\n");
-__RCSID("$NetBSD: traceroute.c,v 1.44 2001/11/04 23:14:35 atatat Exp $");
+__RCSID("$NetBSD: traceroute.c,v 1.45 2002/01/12 02:42:58 yamt Exp $");
 #endif
 #endif
 
@@ -1053,6 +1053,11 @@
        (void)gettimeofday(&now, &tz);
        tvsub(&wait, &now);
 
+       if (wait.tv_sec < 0) {
+               wait.tv_sec = 0;
+               wait.tv_usec = 0;
+       }
+
        retval = select(sock + 1, fdsp, NULL, NULL, &wait);
        free(fdsp);
        if (retval < 0)  {



Home | Main Index | Thread Index | Old Index