[libvirt] [PATCH v2] virsh: time_t is not a long on FreeBSD

Eric Blake eblake at redhat.com
Wed May 25 15:53:33 UTC 2011


On 05/25/2011 09:06 AM, Matthias Bolte wrote:
> localtime_r expects time_t.
> ---
> v2: add overflow check

ACK.

> -            localtime_r(&creation, &time_info);
> +            creation_time_t = creation_longlong;
> +            if (creation_time_t != creation_longlong) {
> +                vshError(ctl, "%s", _("time_t overflow"));

We shouldn't hit this error until 2038, and by then, hopefully more
32-bit platforms (if any are still running) will have switched to 64-bit
time_t. :)  But I agree with keeping this error in the code, since
silent wraparound is always worse than explicit mention of overflow.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110525/bff510d1/attachment-0001.sig>


More information about the libvir-list mailing list