"Ian Abbott" <[EMAIL PROTECTED]> writes:

>> -       asctime (localtime ((time_t *)&cookie->expiry_time)),
>> +       (cookie->expiry_time != ~0UL ?
>> +        asctime (localtime ((time_t *)&cookie->expiry_time))
>> +        : "UNKNOWN"),
>>         cookie->attr, cookie->value));
>>  }
> 
> Yes, except for any other values of cookie->expiry_time that would
> cause localtime() to return a NULL pointer

Good point.

> (in the case of Windows, anything before 1970). Perhaps the return
> value of localtime() should be checked before passing it to
> asctime() as in the modified version of your patch I have attached
> below.

Yes, that's the way to go.  Except I'll probably add a bit more
complexity (sigh) to print something other than "UNKNOWN" when the
expiry time is ~0UL.

> I'm also a little worried about the (time_t *)&cookie->expiry_time
> cast, as cookie->expiry time is of type unsigned long. Is a time_t
> guaranteed to be the same size as an unsigned long?

It's not, but I have a hard time imagining an architecture where
time_t will be *larger* than unsigned long.

Reply via email to