]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
conf: switch other_parse_error() to variable arguments
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 20 Mar 2025 14:20:46 +0000 (15:20 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 20 Mar 2025 14:55:25 +0000 (15:55 +0100)
conf.c

diff --git a/conf.c b/conf.c
index fe202a485fd45b3b5368af861dc3f9d1fa1dad85..8b468f1a394dc9ec16def73fe6c9b5a2ef7e5c5d 100644 (file)
--- a/conf.c
+++ b/conf.c
@@ -363,12 +363,20 @@ command_parse_error(void)
 
 /* ================================================== */
 
+FORMAT_ATTRIBUTE_PRINTF(1, 2)
 static void
-other_parse_error(const char *message)
+other_parse_error(const char *format, ...)
 {
-    LOG_FATAL("%s at line %d%s%s",
-        message, line_number, processed_file ? " in file " : "",
-        processed_file ? processed_file : "");
+  char buf[256];
+  va_list ap;
+
+  va_start(ap, format);
+  vsnprintf(buf, sizeof (buf), format, ap);
+  va_end(ap);
+
+  LOG_FATAL("%s at line %d%s%s",
+            buf, line_number, processed_file ? " in file " : "",
+            processed_file ? processed_file : "");
 }
 
 /* ================================================== */