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.

_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to