summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-09-24 23:42:03 +0200
committerLennart Poettering <lennart@poettering.net>2012-09-24 23:42:03 +0200
commit72f1d5a2880d103dc1c1746f5c02e192e054705e (patch)
treedcdbab4aa7f7a1e04fe0410f4974ed76c61596f3
parent963ddb917de3140308ee62fb642b2307a577a39e (diff)
journal: also use new VA_FORMAT_ADVANCE() macro in sd_journal_send()
-rw-r--r--src/journal/journal-send.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c
index b192f1fb88..d503f3f428 100644
--- a/src/journal/journal-send.c
+++ b/src/journal/journal-send.c
@@ -25,6 +25,7 @@
#include <stddef.h>
#include <unistd.h>
#include <fcntl.h>
+#include <printf.h>
#define SD_JOURNAL_SUPPRESS_LOCATION
@@ -121,6 +122,7 @@ static int fill_iovec_sprintf(const char *format, va_list ap, int extra, struct
while (format) {
struct iovec *c;
char *buffer;
+ va_list aq;
if (i >= n) {
n = MAX(i*2, 4);
@@ -133,10 +135,15 @@ static int fill_iovec_sprintf(const char *format, va_list ap, int extra, struct
iov = c;
}
- if (vasprintf(&buffer, format, ap) < 0) {
+ va_copy(aq, ap);
+ if (vasprintf(&buffer, format, aq) < 0) {
+ va_end(aq);
r = -ENOMEM;
goto fail;
}
+ va_end(aq);
+
+ VA_FORMAT_ADVANCE(format, ap);
IOVEC_SET_STRING(iov[i++], buffer);