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

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

 



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   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]