ap

An audio player suited to my tastes
Log | Files | Refs | README | LICENSE

commit a25242b5742ffb355c6f029873522a090ec6981a
parent 655168cabde97c037a9a5ee53567ebbc77b6a83c
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date:   Sun,  1 Oct 2023 14:29:05 -0700

Use syslog or stderr, not both

Whether syslog is used or stderr is determined by the aps syslog
member.

Diffstat:
Maps/aps.h | 1+
Maps/log.c | 11++++-------
2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/aps/aps.h b/aps/aps.h @@ -12,6 +12,7 @@ struct aps { int close; int logmask; int nfds; + int syslog; int timeout; struct apcon *con; struct client clients[OPEN_MAX]; diff --git a/aps/log.c b/aps/log.c @@ -122,12 +122,9 @@ aps_log(struct aps *aps, int fd, int level, char *subject, char *fmt, ...) "%s: %s", p, fmt), "aps_log level and user format"); va_start(ap, fmt); - va_copy(apc, ap); - vsyslog(level, buf, ap); + if (aps && aps->syslog) + vsyslog(level, buf, ap); + else + vfprintf(stderr, buf, ap); va_end(ap); - - /* LOG_PERROR is non-standard */ - buf[sizeof(buf) > len ? len : (len - 1)] = '\n'; - vfprintf(stderr, buf, apc); - va_end(apc); }