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

[libvirt] [PATCH] avoid printf format-mismatch warnings



autobuild.sh fails like this on at least RHEL5.3:

    cc1: warnings being treated as errors
    qemud.c: In function 'qemudClientReadBuf':
    qemud.c:1470: warning: format '%d' expects type 'int', but argument 7 has type 'ssize_t'
    qemud.c: In function 'qemudClientWriteBuf':
    qemud.c:1695: warning: format '%d' expects type 'int', but argument 7 has type 'ssize_t'
    make[2]: *** [libvirtd-qemud.o] Error 1

so I'm about to apply the following fix:

>From 162177b69fec410b7d940cf9242cba9b147f0bdb Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering redhat com>
Date: Wed, 28 Jan 2009 12:08:26 +0100
Subject: [PATCH] avoid printf format-mismatch warnings

* qemud/qemud.c (qemudClientReadBuf, qemudClientWriteBuf):
Use %lld and a (long long int) cast to print a ssize_t value.
---
 qemud/qemud.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/qemud/qemud.c b/qemud/qemud.c
index eb91533..fa5e17d 100644
--- a/qemud/qemud.c
+++ b/qemud/qemud.c
@@ -1467,7 +1467,8 @@ static ssize_t qemudClientReadBuf(struct qemud_client *client,
     ssize_t ret;

     if (len < 0) {
-        VIR_ERROR(_("unexpected negative length request %d"), len);
+        VIR_ERROR(_("unexpected negative length request %lld"),
+                  (long long int) len);
         qemudDispatchClientFailure(client);
         return -1;
     }
@@ -1692,7 +1693,8 @@ static ssize_t qemudClientWriteBuf(struct qemud_client *client,
     ssize_t ret;

     if (len < 0) {
-        VIR_ERROR(_("unexpected negative length request %d"), len);
+        VIR_ERROR(_("unexpected negative length request %lld"),
+                  (long long int) len);
         qemudDispatchClientFailure(client);
         return -1;
     }
--
1.6.1.1.374.g0d9d7


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