acdf5d
From cbb46dccb2804be3db142f5eb37acf2c0fa7e2b8 Mon Sep 17 00:00:00 2001
acdf5d
From: Jan Friesse <jfriesse@redhat.com>
acdf5d
Date: Tue, 10 Nov 2020 09:51:33 +0100
acdf5d
Subject: [PATCH 1/2] Fix log_perror
acdf5d
acdf5d
Also add definitions of log_printf and log_vprintf with format attribute
acdf5d
so compiler have information about problems in printf strings.
acdf5d
acdf5d
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
acdf5d
---
acdf5d
 spausedd.c | 13 +++++++++++--
acdf5d
 1 file changed, 11 insertions(+), 2 deletions(-)
acdf5d
acdf5d
diff --git a/spausedd.c b/spausedd.c
acdf5d
index d453e39..0a6fe65 100644
acdf5d
--- a/spausedd.c
acdf5d
+++ b/spausedd.c
acdf5d
@@ -91,6 +91,15 @@ static int use_vmguestlib_stealtime = 0;
acdf5d
 static VMGuestLibHandle guestlib_handle;
acdf5d
 #endif
acdf5d
 
acdf5d
+/*
acdf5d
+ * Definitions (for attributes)
acdf5d
+ */
acdf5d
+static void	log_printf(int priority, const char *format, ...)
acdf5d
+    __attribute__((__format__(__printf__, 2, 3)));
acdf5d
+
acdf5d
+static void	log_vprintf(int priority, const char *format, va_list ap)
acdf5d
+    __attribute__((__format__(__printf__, 2, 0)));
acdf5d
+
acdf5d
 /*
acdf5d
  * Logging functions
acdf5d
  */
acdf5d
@@ -155,7 +164,7 @@ log_perror(int priority, const char *s)
acdf5d
 
acdf5d
 	stored_errno = errno;
acdf5d
 
acdf5d
-	log_printf(priority, "%s (%u): %s", stored_errno, strerror(stored_errno));
acdf5d
+	log_printf(priority, "%s (%u): %s", s, stored_errno, strerror(stored_errno));
acdf5d
 }
acdf5d
 
acdf5d
 static int
acdf5d
@@ -577,7 +586,7 @@ poll_run(uint64_t timeout)
acdf5d
 			    steal_perc);
acdf5d
 
acdf5d
 			if (steal_perc > max_steal_threshold) {
acdf5d
-				log_printf(LOG_WARNING, "Steal time is > %0.1f%, this is usually because "
acdf5d
+				log_printf(LOG_WARNING, "Steal time is > %0.1f%%, this is usually because "
acdf5d
 				    "of overloaded host machine", max_steal_threshold);
acdf5d
 			}
acdf5d
 			times_not_scheduled++;
acdf5d
-- 
acdf5d
2.18.2
acdf5d