Date: Tue, 15 Mar 2016 11:03:45 +0000 (UTC) From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r296897 - in head/usr.sbin: autofs ctld iscsid Message-ID: <201603151103.u2FB3jYc088401@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trasz Date: Tue Mar 15 11:03:45 2016 New Revision: 296897 URL: https://svnweb.freebsd.org/changeset/base/296897 Log: Use the log_errno value passed to the function instead of the errno global variable. Suggested by: Daniel Braniss MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/autofs/log.c head/usr.sbin/ctld/log.c head/usr.sbin/iscsid/log.c Modified: head/usr.sbin/autofs/log.c ============================================================================== --- head/usr.sbin/autofs/log.c Tue Mar 15 10:45:55 2016 (r296896) +++ head/usr.sbin/autofs/log.c Tue Mar 15 11:03:45 2016 (r296897) @@ -88,6 +88,7 @@ log_common(int priority, int log_errno, { 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, } } 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); } } } Modified: head/usr.sbin/ctld/log.c ============================================================================== --- head/usr.sbin/ctld/log.c Tue Mar 15 10:45:55 2016 (r296896) +++ head/usr.sbin/ctld/log.c Tue Mar 15 11:03:45 2016 (r296897) @@ -88,6 +88,7 @@ log_common(int priority, int log_errno, { 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, } } 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); } } } Modified: head/usr.sbin/iscsid/log.c ============================================================================== --- head/usr.sbin/iscsid/log.c Tue Mar 15 10:45:55 2016 (r296896) +++ head/usr.sbin/iscsid/log.c Tue Mar 15 11:03:45 2016 (r296897) @@ -88,6 +88,7 @@ log_common(int priority, int log_errno, { 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, } } 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); } } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201603151103.u2FB3jYc088401>