bug-gnulib
[Top][All Lists]
Advanced

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

Re: [libvirt] [PATCH] Pass a correct pointer type to localtime_r(3).


From: Eric Blake
Subject: Re: [libvirt] [PATCH] Pass a correct pointer type to localtime_r(3).
Date: Tue, 04 Sep 2012 10:48:38 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120828 Thunderbird/15.0

On 09/04/2012 10:32 AM, Jasper Lievisse Adriaanse wrote:
> On Tue, Sep 04, 2012 at 09:20:24AM -0600, Eric Blake wrote:
>> [adding bug-gnulib]
>>

>> NACK from the libvirt point of view.  tv_sec is required by POSIX to be
>> of type time_t; so this is a bug in the OpenBSD header, and gnulib
>> should be working around this bug.
> OpenBSD's sys/time.h has this:
> 
> /*
>  * Structure returned by gettimeofday(2) system call,
>  * and used in other calls.
>  */
> struct timeval {
>       long    tv_sec;         /* seconds */
>       long    tv_usec;        /* and microseconds */

Buggy.  But thanks for alerting us to the issue.  POSIX requires:

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_time.h.html#tag_13_64

time_t         tv_sec      Seconds.
suseconds_t    tv_usec     Microseconds.


>>> +    stTm = localtime(&sec);
>>
>> Even grosser - why is virsh using localtime() instead of localtime_r()?
> Oversight probably..

Yeah, but that's pre-existing oversight in libvirt, and shouldn't affect
gnulib.  Libvirt has a syntax check rule which is supposed to avoid
localtime() in favor of localtime_r(); I'll have to check why it isn't
firing properly.

-- 
Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]