commit | 3aef2389802b3b188ba285e8d1eed0e3256937ef | [log] [tgz] |
---|---|---|
author | Pau Espin Pedrol <pespin@sysmocom.de> | Wed Jun 12 18:50:29 2019 +0200 |
committer | laforge <laforge@gnumonks.org> | Thu Jun 13 15:34:01 2019 +0000 |
tree | bef89072f7290f35f9c6c1316689197ef7bf62c4 | |
parent | d1e220fb67e14115512b9020b26ad74c49daefc5 [diff] [blame] |
logging: Check return error from time() call Related: OS#4055 Change-Id: Ief155a76169426a677256e09d3e91751c4e2529f
diff --git a/src/logging.c b/src/logging.c index 73a9c52..4c86473 100644 --- a/src/logging.c +++ b/src/logging.c
@@ -361,7 +361,8 @@ } 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);