diff options
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/autofs/log.c | 15 | ||||
-rw-r--r-- | usr.sbin/ctld/log.c | 15 | ||||
-rw-r--r-- | usr.sbin/iscsid/log.c | 15 |
3 files changed, 27 insertions, 18 deletions
diff --git a/usr.sbin/autofs/log.c b/usr.sbin/autofs/log.c index d5682cc..b3935dc 100644 --- a/usr.sbin/autofs/log.c +++ b/usr.sbin/autofs/log.c @@ -88,6 +88,7 @@ log_common(int priority, int log_errno, const char *fmt, va_list ap) { static char msgbuf[MSGBUF_LEN]; static char msgbuf_strvised[MSGBUF_LEN * 4 + 1]; + char *errstr; int ret; ret = vsnprintf(msgbuf, sizeof(msgbuf), fmt, ap); @@ -121,21 +122,23 @@ log_common(int priority, int log_errno, const char *fmt, va_list ap) } } else { + errstr = strerror(log_errno); + if (peer_name != NULL) { fprintf(stderr, "%s: %s (%s): %s: %s\n", getprogname(), - peer_addr, peer_name, msgbuf_strvised, strerror(errno)); + peer_addr, peer_name, msgbuf_strvised, errstr); syslog(priority, "%s (%s): %s: %s", - peer_addr, peer_name, msgbuf_strvised, strerror(errno)); + peer_addr, peer_name, msgbuf_strvised, errstr); } else if (peer_addr != NULL) { fprintf(stderr, "%s: %s: %s: %s\n", getprogname(), - peer_addr, msgbuf_strvised, strerror(errno)); + peer_addr, msgbuf_strvised, errstr); syslog(priority, "%s: %s: %s", - peer_addr, msgbuf_strvised, strerror(errno)); + peer_addr, msgbuf_strvised, errstr); } else { fprintf(stderr, "%s: %s: %s\n", getprogname(), - msgbuf_strvised, strerror(errno)); + msgbuf_strvised, errstr); syslog(priority, "%s: %s", - msgbuf_strvised, strerror(errno)); + msgbuf_strvised, errstr); } } } diff --git a/usr.sbin/ctld/log.c b/usr.sbin/ctld/log.c index ac838f3..ed66c31 100644 --- a/usr.sbin/ctld/log.c +++ b/usr.sbin/ctld/log.c @@ -88,6 +88,7 @@ log_common(int priority, int log_errno, const char *fmt, va_list ap) { static char msgbuf[MSGBUF_LEN]; static char msgbuf_strvised[MSGBUF_LEN * 4 + 1]; + char *errstr; int ret; ret = vsnprintf(msgbuf, sizeof(msgbuf), fmt, ap); @@ -121,21 +122,23 @@ log_common(int priority, int log_errno, const char *fmt, va_list ap) } } else { + errstr = strerror(log_errno); + if (peer_name != NULL) { fprintf(stderr, "%s: %s (%s): %s: %s\n", getprogname(), - peer_addr, peer_name, msgbuf_strvised, strerror(errno)); + peer_addr, peer_name, msgbuf_strvised, errstr); syslog(priority, "%s (%s): %s: %s", - peer_addr, peer_name, msgbuf_strvised, strerror(errno)); + peer_addr, peer_name, msgbuf_strvised, errstr); } else if (peer_addr != NULL) { fprintf(stderr, "%s: %s: %s: %s\n", getprogname(), - peer_addr, msgbuf_strvised, strerror(errno)); + peer_addr, msgbuf_strvised, errstr); syslog(priority, "%s: %s: %s", - peer_addr, msgbuf_strvised, strerror(errno)); + peer_addr, msgbuf_strvised, errstr); } else { fprintf(stderr, "%s: %s: %s\n", getprogname(), - msgbuf_strvised, strerror(errno)); + msgbuf_strvised, errstr); syslog(priority, "%s: %s", - msgbuf_strvised, strerror(errno)); + msgbuf_strvised, errstr); } } } diff --git a/usr.sbin/iscsid/log.c b/usr.sbin/iscsid/log.c index ea7755f..920c081 100644 --- a/usr.sbin/iscsid/log.c +++ b/usr.sbin/iscsid/log.c @@ -88,6 +88,7 @@ log_common(int priority, int log_errno, const char *fmt, va_list ap) { static char msgbuf[MSGBUF_LEN]; static char msgbuf_strvised[MSGBUF_LEN * 4 + 1]; + char *errstr; int ret; ret = vsnprintf(msgbuf, sizeof(msgbuf), fmt, ap); @@ -121,21 +122,23 @@ log_common(int priority, int log_errno, const char *fmt, va_list ap) } } else { + errstr = strerror(log_errno); + if (peer_name != NULL) { fprintf(stderr, "%s: %s (%s): %s: %s\n", getprogname(), - peer_addr, peer_name, msgbuf_strvised, strerror(errno)); + peer_addr, peer_name, msgbuf_strvised, errstr); syslog(priority, "%s (%s): %s: %s", - peer_addr, peer_name, msgbuf_strvised, strerror(errno)); + peer_addr, peer_name, msgbuf_strvised, errstr); } else if (peer_addr != NULL) { fprintf(stderr, "%s: %s: %s: %s\n", getprogname(), - peer_addr, msgbuf_strvised, strerror(errno)); + peer_addr, msgbuf_strvised, errstr); syslog(priority, "%s: %s: %s", - peer_addr, msgbuf_strvised, strerror(errno)); + peer_addr, msgbuf_strvised, errstr); } else { fprintf(stderr, "%s: %s: %s\n", getprogname(), - msgbuf_strvised, strerror(errno)); + msgbuf_strvised, errstr); syslog(priority, "%s: %s", - msgbuf_strvised, strerror(errno)); + msgbuf_strvised, errstr); } } } |