[PATCH] qemu_nbdkit.c: use %llu to print time_t

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

 



From: Chen Qi <Qi.Chen@xxxxxxxxxxxxx>

Use %lu to print time_t will give use the following error:

  error: format '%lu' expects argument of type 'long unsigned int',
  but argument 10 has type 'time_t' {aka 'long long int'} [-Werror=format=]

So use %llu to print time_t.

Signed-off-by: Chen Qi <Qi.Chen@xxxxxxxxxxxxx>
---
 src/qemu/qemu_nbdkit.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/qemu/qemu_nbdkit.c b/src/qemu/qemu_nbdkit.c
index f099f35e1e..fe660c78e5 100644
--- a/src/qemu/qemu_nbdkit.c
+++ b/src/qemu/qemu_nbdkit.c
@@ -544,18 +544,18 @@ qemuNbdkitCapsFormatCache(qemuNbdkitCaps *nbdkitCaps)
 
     virBufferEscapeString(&buf, "<path>%s</path>\n",
                           nbdkitCaps->path);
-    virBufferAsprintf(&buf, "<nbdkitctime>%lu</nbdkitctime>\n",
-                      nbdkitCaps->ctime);
+    virBufferAsprintf(&buf, "<nbdkitctime>%llu</nbdkitctime>\n",
+                      (long long)nbdkitCaps->ctime);
     virBufferEscapeString(&buf, "<plugindir>%s</plugindir>\n",
                           nbdkitCaps->pluginDir);
-    virBufferAsprintf(&buf, "<plugindirmtime>%lu</plugindirmtime>\n",
-                      nbdkitCaps->pluginDirMtime);
+    virBufferAsprintf(&buf, "<plugindirmtime>%llu</plugindirmtime>\n",
+                      (long long)nbdkitCaps->pluginDirMtime);
     virBufferEscapeString(&buf, "<filterdir>%s</filterdir>\n",
                           nbdkitCaps->filterDir);
-    virBufferAsprintf(&buf, "<filterdirmtime>%lu</filterdirmtime>\n",
-                      nbdkitCaps->filterDirMtime);
-    virBufferAsprintf(&buf, "<selfctime>%lu</selfctime>\n",
-                      nbdkitCaps->libvirtCtime);
+    virBufferAsprintf(&buf, "<filterdirmtime>%llu</filterdirmtime>\n",
+                      (long long)nbdkitCaps->filterDirMtime);
+    virBufferAsprintf(&buf, "<selfctime>%llu</selfctime>\n",
+                      (long long)nbdkitCaps->libvirtCtime);
     virBufferAsprintf(&buf, "<selfvers>%u</selfvers>\n",
                       nbdkitCaps->libvirtVersion);
 
@@ -593,10 +593,10 @@ virNbdkitCapsSaveFile(void *data,
         return -1;
     }
 
-    VIR_DEBUG("Saved caps '%s' for '%s' with (%lu, %lu)",
+    VIR_DEBUG("Saved caps '%s' for '%s' with (%llu, %llu)",
               filename, nbdkitCaps->path,
-              nbdkitCaps->ctime,
-              nbdkitCaps->libvirtCtime);
+              (long long)nbdkitCaps->ctime,
+              (long long)nbdkitCaps->libvirtCtime);
 
     return 0;
 }
@@ -1054,7 +1054,7 @@ qemuNbdkitProcessBuildCommandCurl(qemuNbdkitProcess *proc,
     }
 
     if (proc->source->timeout > 0) {
-        g_autofree char *timeout = g_strdup_printf("%llu", proc->source->timeout);
+        g_autofree char *timeout = g_strdup_printf("%llu", (long long)proc->source->timeout);
         virCommandAddArgPair(cmd, "timeout", timeout);
     }
 
-- 
2.25.1




[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]

  Powered by Linux