bin/155365: if.c in routed fails to compile if time_t and long are different sizes

Milo Hyson milo at cyberlifelabs.com
Tue Mar 8 00:20:11 UTC 2011


>Number:         155365
>Category:       bin
>Synopsis:       if.c in routed fails to compile if time_t and long are different sizes
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 08 00:20:10 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Milo Hyson
>Release:        8.1
>Organization:
CyberLife Labs, Inc.
>Environment:
FreeBSD time64.bellingham.cyberlifelabs.net. 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:55:53 UTC 2010     root at almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
If the size of time_t and long are not the same, building routed fails with a warning about type incompatibility with the format string, %ld.
>How-To-Repeat:
Given fresh sources for 8.1-RELEASE i386:

1) Change the definition of __time_t in sys/i386/include/_types.h to __int64_t.
2) make buildworld

>Fix:
The following patch allows the code to compile but may cause problems with loss of information should long be smaller than time_t.

--- orig.c	2010-01-30 04:11:21.000000000 -0800
+++ fixed.c	2011-03-07 16:14:37.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;


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list