journal: also use new VA_FORMAT_ADVANCE() macro in sd_journal_send()
This commit is contained in:
parent
963ddb917d
commit
72f1d5a288
|
@ -25,6 +25,7 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <printf.h>
|
||||||
|
|
||||||
#define SD_JOURNAL_SUPPRESS_LOCATION
|
#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) {
|
while (format) {
|
||||||
struct iovec *c;
|
struct iovec *c;
|
||||||
char *buffer;
|
char *buffer;
|
||||||
|
va_list aq;
|
||||||
|
|
||||||
if (i >= n) {
|
if (i >= n) {
|
||||||
n = MAX(i*2, 4);
|
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;
|
iov = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vasprintf(&buffer, format, ap) < 0) {
|
va_copy(aq, ap);
|
||||||
|
if (vasprintf(&buffer, format, aq) < 0) {
|
||||||
|
va_end(aq);
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
va_end(aq);
|
||||||
|
|
||||||
|
VA_FORMAT_ADVANCE(format, ap);
|
||||||
|
|
||||||
IOVEC_SET_STRING(iov[i++], buffer);
|
IOVEC_SET_STRING(iov[i++], buffer);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue