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

Daniel P. Berrange berrange at redhat.com
Fri May 13 09:35:49 UTC 2011


On Fri, May 13, 2011 at 08:31:28AM +0200, Matthias Bolte wrote:
> localtime_r expects time_t.
> ---
>  tools/virsh.c |    8 +++++---
>  1 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/virsh.c b/tools/virsh.c
> index 3baa015..93a504e 100644
> --- a/tools/virsh.c
> +++ b/tools/virsh.c
> @@ -10406,7 +10406,8 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd)
>      char *doc = NULL;
>      virDomainSnapshotPtr snapshot = NULL;
>      char *state = NULL;
> -    long creation;
> +    long creation_long;
> +    time_t creation_time_t;
>      char timestr[100];
>      struct tm time_info;
>  
> @@ -10466,9 +10467,10 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd)
>              if (state == NULL)
>                  continue;
>              if (virXPathLong("string(/domainsnapshot/creationTime)", ctxt,
> -                             &creation) < 0)
> +                             &creation_long) < 0)
>                  continue;
> -            localtime_r(&creation, &time_info);
> +            creation_time_t = creation_long;
> +            localtime_r(&creation_time_t, &time_info);
>              strftime(timestr, sizeof(timestr), "%Y-%m-%d %H:%M:%S %z", &time_info);
>  
>              vshPrint(ctl, " %-20s %-25s %s\n", names[i], timestr, state);

ACK

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list