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
@ -1698,9 +1698,12 @@ void fprintlog_write(struct filed *f, struct iovec *iov, int iovcnt, int flags)
|
|||||||
f->f_prevcount = 0;
|
f->f_prevcount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define fmtlogit(bm) logit("%s(%d, 0x%02x, %s, %s, %s, %s, %s, %s)", __func__, \
|
#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->pri, bm->flags, bm->hostname ? bm->hostname : "-", \
|
||||||
bm->proc_id, bm->msgid, bm->sd, bm->msg)
|
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)
|
static int fmt3164(struct buf_msg *buffer, char *fmt, struct iovec *iov, size_t iovmax)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user