From 0f940e06f52f93ae748642e146c3c500a5c4696c Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Fri, 9 Nov 2018 08:35:20 -0600 Subject: [PATCH] drivers/syslog/vsyslog.c: nx_syslog's return value should include the timestamp length --- drivers/syslog/vsyslog.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/syslog/vsyslog.c b/drivers/syslog/vsyslog.c index e6845573ae..f49c72cfa9 100644 --- a/drivers/syslog/vsyslog.c +++ b/drivers/syslog/vsyslog.c @@ -131,16 +131,16 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap) #if defined(CONFIG_SYSLOG_TIMESTAMP) /* Pre-pend the message with the current time, if available */ - (void)lib_sprintf(&stream.public, "[%5d.%06d] ", + ret = lib_sprintf(&stream.public, "[%5d.%06d] ", ts.tv_sec, ts.tv_nsec/1000); +#else + ret = 0; #endif #if defined(CONFIG_SYSLOG_PREFIX) /* Pre-pend the prefix, if available */ - ret = lib_sprintf(&stream.public, "%s", CONFIG_SYSLOG_PREFIX_STRING); -#else - ret = 0; + ret += lib_sprintf(&stream.public, "%s", CONFIG_SYSLOG_PREFIX_STRING); #endif /* Generate the output */