Subject: Re: amd-64 kernel compile failure
To: None <current-users@netbsd.org>
From: Christos Zoulas <christos@astron.com>
List: current-users
Date: 12/06/2005 17:55:34
In article <20051206163541.GB21755@altair.coris.org.uk>,
Julian Coleman <jdc@coris.org.uk> wrote:
>> A new error:
>>
>> dependall ===> usr.sbin/lmcconfig
>> /home/test2/current/src/usr.sbin/lmcconfig/lmcconfig.c: In function
>> `print_events':
>
>This patch should fix it.
>
>J
>
> - - 8< - - - - - - - - - - - - - Cut here - - - - - - - - - - - - - >8 - -
>
>--- lmcconfig.c.dist 2005-12-06 03:12:35.000000000 +0000
>+++ lmcconfig.c 2005-12-06 16:28:36.000000000 +0000
>@@ -1092,7 +1092,7 @@
> struct timezone tz;
>
> gettimeofday(&tv, &tz);
>- time = (char *)ctime((time_t *)&tv);
>+ time = ctime((time_t *)&tv.tv_sec);
Please do not do this... It breaks on __LP64__ big endian machines.
tv.tv_sec on sparc64 for example is long and time_t is int.
You should *really* be doing:
time_t tsec = tv.tv_sec;
ctime(&tsec);
casts are evil.
christos