Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/usr.sbin/rtsold



On Tue, Mar 18, 2014 at 08:21:19PM +0000, Christos Zoulas wrote:
> In article <20140318201420.GO20347%snowdrop.l8s.co.uk@localhost>,
> David Laight  <david%l8s.co.uk@localhost> wrote:
> >On Tue, Mar 18, 2014 at 03:30:09PM -0400, Christos Zoulas wrote:
> >> Module Name:       src
> >> Committed By:      christos
> >> Date:              Tue Mar 18 19:30:09 UTC 2014
> >> 
> >> Modified Files:
> >>    src/usr.sbin/rtsold: rtsold.c
> >> 
> >> Log Message:
> >> use time_t for time
> >
> >It isn't a time_t type time.
> 
> It is assigned to a time_t. long might not be wide enough; the value is
> unsigned and it is assigned to a signed type.

Only if 'long' is smaller than 1000000.
i386 fails on the line:
    long interval = arc4random() /* uint32_t */ % 1000000;
If you use 'unsigned long' then amd64 fails a line later doing:
    xxx.tv_usec = interval / 1000000;
The compiler should be able to tell that neither of those lines
is going to cause any problems.

There is no reason to force 32bit systems to do unnecessary 64bit maths.

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index