[libvirt] [PATCH] virtlogd: use PRIu64 to print 64bit types

Daniel P. Berrange berrange at redhat.com
Thu Nov 26 17:52:11 UTC 2015


On Thu, Nov 26, 2015 at 06:46:13PM +0100, Guido Günther wrote:
> 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 | 3 ++-
>  tests/virrotatingfiletest.c       | 4 +++-
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/src/logging/log_daemon_dispatch.c b/src/logging/log_daemon_dispatch.c
> index 269255a..7391a6f 100644
> --- a/src/logging/log_daemon_dispatch.c
> +++ b/src/logging/log_daemon_dispatch.c
> @@ -21,6 +21,7 @@
>   */
>  
>  #include <config.h>
> +#include <inttypes.h>
>  
>  #include "rpc/virnetserver.h"
>  #include "rpc/virnetserverclient.h"
> @@ -118,7 +119,7 @@ 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"),
> +                       _("Requested data len %"PRIu64" is larger than maximum %d"),

We don't ever use PRIu64 in libvirt - gnulib guarantees that %llu and
%lld are always used for formatting 64bit ints. 

Regards,
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