Avoid NULL pointer to vsnprintf()
GLIBC is friendly enough to check for NULL and replace segfault with "(null)", but other C-libs may not handle it as gracefully. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
parent
558caf1a10
commit
1018d4a7f4
@ -1699,8 +1699,11 @@ void fprintlog_write(struct filed *f, struct iovec *iov, int iovcnt, int flags)
|
||||
}
|
||||
|
||||
#define fmtlogit(bm) logit("%s(%d, 0x%02x, %s, %s, %s, %s, %s, %s)", __func__, \
|
||||
bm->pri, bm->flags, bm->hostname, bm->app_name, \
|
||||
bm->proc_id, bm->msgid, bm->sd, bm->msg)
|
||||
bm->pri, bm->flags, bm->hostname ? bm->hostname : "-", \
|
||||
bm->app_name ? bm->app_name : "-", \
|
||||
bm->proc_id ? bm->proc_id : "-", \
|
||||
bm->msgid ? bm->msgid : "-", \
|
||||
bm->sd ? bm->sd : "-", bm->msg ? bm->msg : "-")
|
||||
|
||||
static int fmt3164(struct buf_msg *buffer, char *fmt, struct iovec *iov, size_t iovmax)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user