[PATCH] virtlogd: use %llu to print 64bit types

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

 



Otherwise we fail on 32bit with:

CC     logging/virtlogd-log_daemon_dispatch.o
logging/log_daemon_dispatch.c: In function 'virLogManagerProtocolDispatchDomainReadLogFile':
logging/log_daemon_dispatch.c:120:9: error: format '%zu' expects argument of type 'size_t', but argument 7 has type 'uint64_t' [-Werror=format]
---
 src/logging/log_daemon_dispatch.c | 5 +++--
 tests/virrotatingfiletest.c       | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/logging/log_daemon_dispatch.c b/src/logging/log_daemon_dispatch.c
index 269255a..160ab00 100644
--- a/src/logging/log_daemon_dispatch.c
+++ b/src/logging/log_daemon_dispatch.c
@@ -118,8 +118,9 @@ virLogManagerProtocolDispatchDomainReadLogFile(virNetServerPtr server ATTRIBUTE_
 
     if (args->maxlen > VIR_LOG_MANAGER_PROTOCOL_STRING_MAX) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Requested data len %zu is larger than maximum %d"),
-                       args->maxlen, VIR_LOG_MANAGER_PROTOCOL_STRING_MAX);
+                       _("Requested data len %llu is larger than maximum %d"),
+                       (unsigned long long)args->maxlen,
+                       VIR_LOG_MANAGER_PROTOCOL_STRING_MAX);
         goto cleanup;
     }
 
diff --git a/tests/virrotatingfiletest.c b/tests/virrotatingfiletest.c
index ed55e63..03e9664 100644
--- a/tests/virrotatingfiletest.c
+++ b/tests/virrotatingfiletest.c
@@ -57,8 +57,9 @@ static int testRotatingFileWriterAssertOneFileSize(const char *filename,
             fprintf(stderr, "File %s should not exist\n", filename);
             return -1;
         } else if (sb.st_size != size) {
-            fprintf(stderr, "File %s should be %zu bytes not %zu\n",
-                    filename, size, sb.st_size);
+            fprintf(stderr, "File %s should be %llu bytes not %llu\n",
+                    filename, (unsigned long long)size,
+                    (unsigned long long)sb.st_size);
             return -1;
         } else {
             return 0;
-- 
2.6.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



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