[libvirt] [PATCH] avoid format string warnings

Jim Meyering jim at meyering.net
Mon Dec 1 10:24:19 UTC 2008


Hi Dan,

I've just applied all of your changes, built, and saw some new warnings:

  uml_driver.c:1742: warning: format not a string literal and no format arguments
  uml_driver.c:1748: warning: format not a string literal and no format arguments
  uml_driver.c:1785: warning: format not a string literal and no format arguments
  openvz_conf.c:468: warning: format not a string literal and no format arguments

But they were introduced before your changes.
Here's the patch, on top of your changes.
Note that as is, the patch does not apply to the latest in CVS,
so my checking it in there would induce merge conflicts for you.
So I'll hold off until after your 28-part series is committed.

Jim

>From fb32deb5dfb2a3c6b598de619f25c0bae4314a05 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Mon, 1 Dec 2008 11:17:08 +0100
Subject: [PATCH] avoid format string warnings

* src/uml_driver.c (umlDomainBlockPeek): Put "%s" before each literal
format string with no % directive.
* src/openvz_conf.c (openvzGetNodeCPUs): Likewise.
---
 src/openvz_conf.c |    2 +-
 src/uml_driver.c  |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/openvz_conf.c b/src/openvz_conf.c
index fc4ef20..1361c53 100644
--- a/src/openvz_conf.c
+++ b/src/openvz_conf.c
@@ -466,7 +466,7 @@ openvzGetNodeCPUs(void)

     if (virNodeInfoPopulate(NULL, &nodeinfo) < 0) {
         openvzError(NULL, VIR_ERR_INTERNAL_ERROR,
-                      _("Cound not read nodeinfo"));
+                    "%s", _("Cound not read nodeinfo"));
         return 0;
     }

diff --git a/src/uml_driver.c b/src/uml_driver.c
index d2f2c7b..8d33c70 100644
--- a/src/uml_driver.c
+++ b/src/uml_driver.c
@@ -1740,13 +1740,13 @@ umlDomainBlockPeek (virDomainPtr dom,

     if (!vm) {
         umlReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
-                          _("no domain with matching uuid"));
+                        "%s", _("no domain with matching uuid"));
         goto cleanup;
     }

     if (!path || path[0] == '\0') {
         umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
-                         _("NULL or empty path"));
+                       "%s", _("NULL or empty path"));
         goto cleanup;
     }

@@ -1783,7 +1783,7 @@ umlDomainBlockPeek (virDomainPtr dom,
         ret = 0;
     } else {
         umlReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
-                        _("invalid path"));
+                        "%s", _("invalid path"));
     }

 cleanup:
--
1.6.0.4.1044.g77718




More information about the libvir-list mailing list