]> git.proxmox.com Git - pve-firewall.git/commitdiff
fixup va_arg usage
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 9 Jan 2019 13:26:00 +0000 (14:26 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 9 Jan 2019 13:26:00 +0000 (14:26 +0100)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/pvefw-logger.c

index 506568caccfa0ee71e5e085385508dcaacf0b805..9c6fe4ac7359a22d13536dac90f79e11c934f0f8 100644 (file)
@@ -196,8 +196,7 @@ queue_log_entry(struct log_entry *le)
 static void
 log_status_message(guint loglevel, const char *fmt, ...)
 {
 static void
 log_status_message(guint loglevel, const char *fmt, ...)
 {
-    va_list ap;
-    va_start(ap, fmt);
+    va_list ap, ap2;
 
     if (loglevel > 7 ) loglevel = 7; // syslog defines level 0-7
 
 
     if (loglevel > 7 ) loglevel = 7; // syslog defines level 0-7
 
@@ -207,7 +206,10 @@ log_status_message(guint loglevel, const char *fmt, ...)
 
     LEPRINTTIME(time(NULL));
 
 
     LEPRINTTIME(time(NULL));
 
+    va_start(ap, fmt);
+    va_copy(ap2, ap);
     le->len += vsnprintf(le->buf + le->len, LE_MAX - le->len, fmt, ap);
     le->len += vsnprintf(le->buf + le->len, LE_MAX - le->len, fmt, ap);
+    va_end(ap);
 
     LEPRINTF("\n");
 
 
     LEPRINTF("\n");
 
@@ -215,7 +217,8 @@ log_status_message(guint loglevel, const char *fmt, ...)
 
     // also log to syslog
 
 
     // also log to syslog
 
-    vsyslog(loglevel, fmt, ap);
+    vsyslog(loglevel, fmt, ap2);
+    va_end(ap2);
 }
 
 static int
 }
 
 static int