Change in ...libosmocore[master]: logging: Check return error from time() call

laforge gerrit-no-reply at lists.osmocom.org
Thu Jun 13 15:34:01 UTC 2019


laforge has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/libosmocore/+/14432 )

Change subject: logging: Check return error from time() call
......................................................................

logging: Check return error from time() call

Related: OS#4055
Change-Id: Ief155a76169426a677256e09d3e91751c4e2529f
---
M src/logging.c
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



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);

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/14432
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ief155a76169426a677256e09d3e91751c4e2529f
Gerrit-Change-Number: 14432
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190613/3fbbc55d/attachment.html>


More information about the gerrit-log mailing list