Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Mar 2011 00:19:17 GMT
From:      Milo Hyson <milo@cyberlifelabs.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/155365: if.c in routed fails to compile if time_t and long are different sizes
Message-ID:  <201103080019.p280JHYB041143@red.freebsd.org>
Resent-Message-ID: <201103080020.p280KBGb054464@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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@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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103080019.p280JHYB041143>