[libvirt] [PATCH] enable format-safety checks for virDomainReportError

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

 



This enables format-safety checks for virDomainReportError,
so that if you try to print e.g., an int via "%s", gcc will
detect it.  The Makefile.maint check ensures that all string
arguments to virDomainReportError are marked for translation
with _(...).

>From 65c7fc8bdbf491a02d1d14fcdef429ba1c9e0dea Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@xxxxxxxxxx>
Date: Fri, 18 Jul 2008 12:46:38 +0200
Subject: [PATCH] enable format-safety checks for virDomainReportError

* src/domain_conf.c (virDomainReportError): Declare using
ATTRIBUTE_FORMAT(printf, 3, 4).
* Makefile.maint (msg_gen_function): Add virDomainReportError.
---
 Makefile.maint    |    1 +
 src/domain_conf.c |    4 ++++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/Makefile.maint b/Makefile.maint
index 5da2984..03800f8 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -352,6 +352,7 @@ msg_gen_function += ReportError
 msg_gen_function += qemudReportError
 msg_gen_function += openvzLog
 msg_gen_function += openvzError
+msg_gen_function += virDomainReportError

 # Uncomment the following and run "make syntax-check" to see diagnostics
 # that are not yet marked for translation, but that need to be rewritten
diff --git a/src/domain_conf.c b/src/domain_conf.c
index 82c0ee6..2ff5d1a 100644
--- a/src/domain_conf.c
+++ b/src/domain_conf.c
@@ -128,6 +128,10 @@ VIR_ENUM_IMPL(virDomainGraphics, VIR_DOMAIN_GRAPHICS_TYPE_LAST,

 static void virDomainReportError(virConnectPtr conn,
                                  int code, const char *fmt, ...)
+  ATTRIBUTE_FORMAT(printf, 3, 4);
+
+static void virDomainReportError(virConnectPtr conn,
+                                 int code, const char *fmt, ...)
 {
     va_list args;
     char errorMessage[1024];
--
1.5.6.3.440.ge3a8d

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