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

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

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:


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

Attachment: signature.asc
Description: OpenPGP digital signature

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