summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-06-08 17:41:32 +0000
committerNick Mathewson <nickm@torproject.org>2005-06-08 17:41:32 +0000
commit8b2a7ff9feb3dc779f2f7e7cf4784442adfba4ab (patch)
treeecd76f896995f70296fe020e6ab7b99861de8afe /src
parent4c43789435ff4e66d886443af431a915b33ed3e7 (diff)
downloadtor-8b2a7ff9feb3dc779f2f7e7cf4784442adfba4ab.tar.gz
tor-8b2a7ff9feb3dc779f2f7e7cf4784442adfba4ab.zip
Remove extraneous newlines from libevent log messages. Backport candidate?
svn:r4350
Diffstat (limited to 'src')
-rw-r--r--src/common/log.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/common/log.c b/src/common/log.c
index 609bf76bf7..6bcc75e3a9 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -499,23 +499,29 @@ static const char *suppress_msg = NULL;
static void
libevent_logging_callback(int severity, const char *msg)
{
+ char buf[1024];
+ size_t n;
if (suppress_msg && strstr(msg, suppress_msg))
return;
+ n = strlcpy(buf, msg, sizeof(buf));
+ if (n && n < sizeof(buf) && buf[n-1] == '\n') {
+ buf[n-1] = '\0';
+ }
switch (severity) {
case _EVENT_LOG_DEBUG:
- log(LOG_DEBUG, "Message from libevent: %s", msg);
+ log(LOG_DEBUG, "Message from libevent: %s", buf);
break;
case _EVENT_LOG_MSG:
- log(LOG_INFO, "Message from libevent: %s", msg);
+ log(LOG_INFO, "Message from libevent: %s", buf);
break;
case _EVENT_LOG_WARN:
- log(LOG_WARN, "Warning from libevent: %s", msg);
+ log(LOG_WARN, "Warning from libevent: %s", buf);
break;
case _EVENT_LOG_ERR:
- log(LOG_ERR, "Error from libevent: %s", msg);
+ log(LOG_ERR, "Error from libevent: %s", buf);
break;
default:
- log(LOG_WARN, "Message [%d] from libevent: %s", severity, msg);
+ log(LOG_WARN, "Message [%d] from libevent: %s", severity, buf);
break;
}
}