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

Matthias Bolte matthias.bolte at googlemail.com
Fri May 13 06:31:28 UTC 2011


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);
-- 
1.7.0.4




More information about the libvir-list mailing list