aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--syslogd/logfile.c4
-rw-r--r--syslogd/proto.c6
2 files changed, 8 insertions, 2 deletions
diff --git a/syslogd/logfile.c b/syslogd/logfile.c
index ec82d0c..62e58f4 100644
--- a/syslogd/logfile.c
+++ b/syslogd/logfile.c
@@ -151,10 +151,10 @@ static int logfile_write(logfile_t *file, const syslog_msg_t *msg)
if (fac_name == NULL)
return -1;
- ret = dprintf(file->fd, "[%s][%s][%s][%u] %s", timebuf,
+ ret = dprintf(file->fd, "[%s][%s][%s][%u] %s\n", timebuf,
fac_name, lvl_str, msg->pid, msg->message);
} else {
- ret = dprintf(file->fd, "[%s][%s][%u] %s", timebuf, lvl_str,
+ ret = dprintf(file->fd, "[%s][%s][%u] %s\n", timebuf, lvl_str,
msg->pid, msg->message);
}
diff --git a/syslogd/proto.c b/syslogd/proto.c
index 0851ced..4ab2f47 100644
--- a/syslogd/proto.c
+++ b/syslogd/proto.c
@@ -132,6 +132,7 @@ int syslog_msg_parse(syslog_msg_t *msg, char *str)
struct tm tstamp;
pid_t pid = 0;
int priority;
+ size_t len;
memset(msg, 0, sizeof(*msg));
@@ -177,6 +178,11 @@ int syslog_msg_parse(syslog_msg_t *msg, char *str)
msg->ident = ident;
msg->message = str;
+ len = strlen(str);
+ while (len > 0 && isspace(str[len - 1]))
+ --len;
+ str[len] = '\0';
+
if (ident != NULL) {
for (ptr = ident; *ptr != '\0'; ++ptr) {
if (!isalnum(*ptr))