diff options
author | Till Kamppeter <till.kamppeter@gmail.com> | 2018-01-16 18:38:12 -0200 |
---|---|---|
committer | Till Kamppeter <till.kamppeter@gmail.com> | 2018-01-16 18:38:12 -0200 |
commit | 39b7b10f69ddcc6a0d9454df42f85ef2f31c6349 (patch) | |
tree | 79fac0b445fdabfdf52c43dbfe7848cc4c18c5c3 /src/logging.c | |
parent | 02578687b1ad4d946388aec3ba0e5e085388804d (diff) |
Do not use vsyslog()
In contrary to what is told in the syslog(3) man page, the function
vsyslog() actually does not exist in Ubuntu (according to
/usr/include/syslog.h).
Diffstat (limited to 'src/logging.c')
-rw-r--r-- | src/logging.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/logging.c b/src/logging.c index d66d304..01dbb86 100644 --- a/src/logging.c +++ b/src/logging.c @@ -24,6 +24,8 @@ void BASE_LOG(enum log_level level, const char *fmt, ...) { + char buf[65536]; + if (!g_options.verbose_mode && level != LOGGING_ERROR) return; @@ -31,8 +33,10 @@ void BASE_LOG(enum log_level level, const char *fmt, ...) va_start(arg, fmt); if (g_options.log_destination == LOGGING_STDERR) vfprintf(stderr, fmt, arg); - else if (g_options.log_destination == LOGGING_SYSLOG) - vsyslog(LOG_ERR, fmt, arg); + else if (g_options.log_destination == LOGGING_SYSLOG) { + vsnprintf(buf, sizeof(buf), fmt, arg); + syslog(LOG_ERR, buf); + } va_end(arg); } |