Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Dec 2012 03:35:10 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r244883 - stable/7/usr.sbin/syslogd
Message-ID:  <201212310335.qBV3ZA9W047823@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Mon Dec 31 03:35:09 2012
New Revision: 244883
URL: http://svnweb.freebsd.org/changeset/base/244883

Log:
  MFC 244523:
  - Make sure that errno isn't modified before calling logerror() in error
    conditions.
  - Don't check for AF_INET6 when compiled without INET6 support.
  
  Approved by:	emaste (co-mentor)

Modified:
  stable/7/usr.sbin/syslogd/syslogd.c

Modified: stable/7/usr.sbin/syslogd/syslogd.c
==============================================================================
--- stable/7/usr.sbin/syslogd/syslogd.c	Mon Dec 31 03:35:01 2012	(r244882)
+++ stable/7/usr.sbin/syslogd/syslogd.c	Mon Dec 31 03:35:09 2012	(r244883)
@@ -1877,6 +1877,7 @@ cfline(const char *line, struct filed *f
 
 			pri = decode(buf, prioritynames);
 			if (pri < 0) {
+				errno = 0;
 				(void)snprintf(ebuf, sizeof ebuf,
 				    "unknown priority name \"%s\"", buf);
 				logerror(ebuf);
@@ -1905,6 +1906,7 @@ cfline(const char *line, struct filed *f
 			} else {
 				i = decode(buf, facilitynames);
 				if (i < 0) {
+					errno = 0;
 					(void)snprintf(ebuf, sizeof ebuf,
 					    "unknown facility name \"%s\"",
 					    buf);
@@ -2660,6 +2662,7 @@ socksetup(int af, const char *bindhostna
 			logerror("socket");
 			continue;
 		}
+#ifdef INET6
 		if (r->ai_family == AF_INET6) {
 			if (setsockopt(*s, IPPROTO_IPV6, IPV6_V6ONLY,
 				       (char *)&on, sizeof (on)) < 0) {
@@ -2668,6 +2671,7 @@ socksetup(int af, const char *bindhostna
 				continue;
 			}
 		}
+#endif
 		if (setsockopt(*s, SOL_SOCKET, SO_REUSEADDR,
 			       (char *)&on, sizeof (on)) < 0) {
 			logerror("setsockopt");
@@ -2684,8 +2688,8 @@ socksetup(int af, const char *bindhostna
 		 */
 		if (!NoBind) {
 			if (bind(*s, r->ai_addr, r->ai_addrlen) < 0) {
-				close(*s);
 				logerror("bind");
+				close(*s);
 				continue;
 			}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212310335.qBV3ZA9W047823>