svn commit: r303518 - head/contrib/blacklist/lib

Kurt Lidl lidl at FreeBSD.org
Fri Jul 29 21:11:33 UTC 2016


Author: lidl
Date: Fri Jul 29 21:11:32 2016
New Revision: 303518
URL: https://svnweb.freebsd.org/changeset/base/303518

Log:
  libblacklist: Do not use %m for logging, use strerror(errno)
  
  The blacklist library can accept a function to use for logging,
  defaulting to vsyslog(), if no function is specified.  Make the
  blacklist library use strerror(errno) explicitly, instead of %m,
  so that the passed in function does not need to support the
  syslog specific placeholder.
  
  This matches a change already submitted and accepted upstream.
  
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/contrib/blacklist/lib/bl.c

Modified: head/contrib/blacklist/lib/bl.c
==============================================================================
--- head/contrib/blacklist/lib/bl.c	Fri Jul 29 21:07:17 2016	(r303517)
+++ head/contrib/blacklist/lib/bl.c	Fri Jul 29 21:11:32 2016	(r303518)
@@ -152,8 +152,8 @@ bl_init(bl_t b, bool srv)
 		b->b_fd = socket(PF_LOCAL,
 		    SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK|SOCK_NOSIGPIPE, 0);
 		if (b->b_fd == -1) {
-			bl_log(b->b_fun, LOG_ERR, "%s: socket failed (%m)",
-			    __func__);
+			bl_log(b->b_fun, LOG_ERR, "%s: socket failed (%s)",
+			    __func__, strerror(errno));
 			BL_UNLOCK(b);
 			return -1;
 		}
@@ -200,8 +200,8 @@ bl_init(bl_t b, bool srv)
 			 */
 			if (b->b_connected != 1) {
 				bl_log(b->b_fun, LOG_DEBUG,
-				    "%s: connect failed for `%s' (%m)",
-				    __func__, sun->sun_path);
+				    "%s: connect failed for `%s' (%s)",
+				    __func__, sun->sun_path, strerror(errno));
 				b->b_connected = 1;
 			}
 			BL_UNLOCK(b);
@@ -220,8 +220,8 @@ bl_init(bl_t b, bool srv)
 		errno = serrno;
 		if (rv == -1) {
 			bl_log(b->b_fun, LOG_ERR,
-			    "%s: bind failed for `%s' (%m)",
-			    __func__, sun->sun_path);
+			    "%s: bind failed for `%s' (%s)",
+			    __func__, sun->sun_path, strerror(errno));
 			goto out;
 		}
 	}
@@ -260,7 +260,8 @@ bl_init(bl_t b, bool srv)
 	if (setsockopt(b->b_fd, CRED_LEVEL, CRED_NAME,
 	    &one, (socklen_t)sizeof(one)) == -1) {
 		bl_log(b->b_fun, LOG_ERR, "%s: setsockopt %s "
-		    "failed (%m)", __func__, __STRING(CRED_NAME));
+		    "failed (%s)", __func__, __STRING(CRED_NAME),
+		    strerror(errno));
 		goto out;
 	}
 #endif
@@ -296,7 +297,8 @@ bl_create(bool srv, const char *path, vo
 	return b;
 out:
 	free(b);
-	bl_log(fun, LOG_ERR, "%s: malloc failed (%m)", __func__);
+	bl_log(fun, LOG_ERR, "%s: malloc failed (%s)", __func__,
+	    strerror(errno));
 	return NULL;
 }
 
@@ -451,7 +453,8 @@ bl_recv(bl_t b)
 
         rlen = recvmsg(b->b_fd, &msg, 0);
         if (rlen == -1) {
-		bl_log(b->b_fun, LOG_ERR, "%s: recvmsg failed (%m)", __func__);
+		bl_log(b->b_fun, LOG_ERR, "%s: recvmsg failed (%s)", __func__,
+		    strerror(errno));
 		return NULL;
         }
 


More information about the svn-src-head mailing list