aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/autofs
diff options
context:
space:
mode:
authorGlen Barber <gjb@FreeBSD.org>2016-04-04 23:55:32 +0000
committerGlen Barber <gjb@FreeBSD.org>2016-04-04 23:55:32 +0000
commitd60840138f6292c1ceeb177ebe797eca0b2749da (patch)
treea027fe5a27446f32854d6a07b34b5f2a992bf283 /usr.sbin/autofs
parentb0b644948c7ed5773b80b8060bb08cb39c024ef5 (diff)
parent8e8df7d50ad7f2b0bb1cb0b8c18242ca511635c3 (diff)
downloadsrc-d60840138f6292c1ceeb177ebe797eca0b2749da.tar.gz
src-d60840138f6292c1ceeb177ebe797eca0b2749da.zip
Notes
Diffstat (limited to 'usr.sbin/autofs')
-rw-r--r--usr.sbin/autofs/log.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/usr.sbin/autofs/log.c b/usr.sbin/autofs/log.c
index d5682cc7263f..b3935dc0ed01 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);
}
}
}