Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Mar 2011 15:00:17 -0800
From:      Milo Hyson <milo@cyberlifelabs.com>
To:        freebsd-questions@freebsd.org
Subject:   Bug in routed?
Message-ID:  <95109270-7F98-46B3-B0A8-B0578772374A@cyberlifelabs.com>

next in thread | raw e-mail | index | archive | help
I'm posting this in questions because 1) I'm not sure if it's really a =
defect, and 2) I'm not sure what other list might be more appropriate.

I've been experimenting with modifications to the i386 platform in =
STABLE-8 to support 64-bit time_t values. After changing =
sys/i386/include/_types.h so that __time_t is defined as __int64_t, I =
received a warning when compiling sbin/routed/if.c that complained about =
passing a time_t for %ld. The following patch illustrates the change I =
made to fix this:

--- orig/if.c	2011-03-05 14:25:47.000000000 -0800
+++ new/if.c	2011-03-05 14:26:01.000000000 -0800
@@ -950,8 +950,8 @@
 					trace_act("interface %s has been =
off"
 						  " %ld seconds; forget =
it",
 						  ifp->int_name,
-						  (long)now.tv_sec-
-						      ifp->int_data.ts);
+						  (long)(now.tv_sec-
+						      =
ifp->int_data.ts));
 					ifdel(ifp);
 				}
 				continue;

I'm guessing the original intent here was for the result of the =
subtraction to be passed as a long to trace_act(), but in actuality it's =
passed as a time_t. The original code compiles just fine if time_t and =
long are the same size.

Additional note, this particular code fragment does not seem to exist in =
-current, so the issue appears limited to -stable.

- Milo Hyson
Chief Scientist
CyberLife Labs, Inc.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?95109270-7F98-46B3-B0A8-B0578772374A>