summaryrefslogtreecommitdiffstats
path: root/src/logging.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/logging.c')
-rw-r--r--src/logging.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/logging.c b/src/logging.c
index 73a9c52c..4c864739 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -361,7 +361,8 @@ static void _output(struct log_target *target, unsigned int subsys,
} else if (target->print_timestamp) {
char *timestr;
time_t tm;
- tm = time(NULL);
+ if ((tm = time(NULL)) == (time_t) -1)
+ goto err;
timestr = ctime(&tm);
timestr[strlen(timestr)-1] = '\0';
ret = snprintf(buf + offset, rem, "%s ", timestr);