From 1bcdcd2ef0c1fda6b197ead493f9413f0d2ecfc2 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Tue, 9 Dec 2008 21:23:31 +0000 Subject: [PATCH] init: do not eat last char in messages; do not print duplicate "init:" prefix to syslog --- init/init.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/init/init.c b/init/init.c index 1caf45b8d..10f5ba68d 100644 --- a/init/init.c +++ b/init/init.c @@ -118,18 +118,18 @@ static void message(int where, const char *fmt, ...) msg[0] = '\r'; va_start(arguments, fmt); - l = vsnprintf(msg + 1, sizeof(msg) - 2, fmt, arguments); - if (l > sizeof(msg) - 2) - l = sizeof(msg) - 2; + l = 1 + vsnprintf(msg + 1, sizeof(msg) - 2, fmt, arguments); + if (l > sizeof(msg) - 1) + l = sizeof(msg) - 1; msg[l] = '\0'; va_end(arguments); if (ENABLE_FEATURE_INIT_SYSLOG) { - /* Log the message to syslogd */ if (where & L_LOG) { - /* don't print out "\r" */ - openlog(applet_name, 0, LOG_DAEMON); - syslog(LOG_INFO, "init: %s", msg + 1); + /* Log the message to syslogd */ + openlog("init", 0, LOG_DAEMON); + /* don't print "\r" */ + syslog(LOG_INFO, "%s", msg + 1); closelog(); } msg[l++] = '\n'; -- 2.25.1