Paul Martin wrote:

radioclkd tries a binary chop across the full range of time_t, starting with
the middle value that the type can hold. Unfortunately, gmtime() doesn't
like handing the value 0x4000000000000000

What happens if you add the following line at line 213 in radioclkd.c?

        /* calculate the number of magnitude bits in a time_t */
        for (bits=0,timep=1;timep>0;bits++,timep<<=1)
                ;

+       if (bits > 48) bits = 48;

        /* if time_t is signed, 0 is the median value else 1<<bits is median */
        timep = (timep<0) ? 0 : ((time_t) 1<<bits);

This prevents the segfault.

This limits the range of time_t values to years 1970 to 8921556. If we're
still using longwave radio clocks in eight million years time, we've got
major problems.

So your fix is a practical one although I guess Jonathan's suggestions might provide a 'better' solution - I'll leave it to you to decide. I'm no C coder so trying Jonathan's suggestions out would require some research on my part (that would have to wait until next weekend). I'm more than happy to test other patches out sooner though.

Many thanks to both for the prompt response.

--
Mark Scott
[EMAIL PROTECTED]



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to