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

pespin gerrit-no-reply at lists.osmocom.org
Wed Jun 12 16:50:58 UTC 2019


pespin has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/32/14432/1

diff --git a/src/logging.c b/src/logging.c
index b8960f9..f8dfd5a 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -362,7 +362,8 @@
 			/* man ctime: user-supplied buffer should have room for at least 26 bytes */
 			char ctime_buf[26];
 			time_t tm;
-			tm = time(NULL);
+			if ((tm = time(NULL)) == (time_t) -1)
+				goto err;
 			if (!ctime_r(&tm, ctime_buf))
 				goto err;
 			/* Remove new line char atthe end added by ctime */

-- 
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: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190612/cb54e576/attachment-0001.html>


More information about the gerrit-log mailing list