aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorKurt Lidl <lidl@FreeBSD.org>2016-07-29 21:11:32 +0000
committerKurt Lidl <lidl@FreeBSD.org>2016-07-29 21:11:32 +0000
commit4e9ac06d0d405cd2090e3091e01f416f7a0d8326 (patch)
tree8615eb0d3943d009ef38e69bddad031e20dddeb1 /contrib
parent897d0c6617f71ebfe94580c52d9a8f52d38f2a9d (diff)
downloadsrc-4e9ac06d0d405cd2090e3091e01f416f7a0d8326.tar.gz
src-4e9ac06d0d405cd2090e3091e01f416f7a0d8326.zip
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
Notes
Notes: svn path=/head/; revision=303518
Diffstat (limited to 'contrib')
-rw-r--r--contrib/blacklist/lib/bl.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/contrib/blacklist/lib/bl.c b/contrib/blacklist/lib/bl.c
index bca52cfbc8fe..3c3201d26aec 100644
--- a/contrib/blacklist/lib/bl.c
+++ b/contrib/blacklist/lib/bl.c
@@ -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, void (*fun)(int, const char *, va_list))
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;
}