Change in libosmocore[master]: timerfd_create(): Fix error handling of osmo_fd_register()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Oct 21 12:10:57 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/11413 )

Change subject: timerfd_create(): Fix error handling of osmo_fd_register()
......................................................................

timerfd_create(): Fix error handling of osmo_fd_register()

Change-Id: Ia2528cc3e3155bbc9cb32dee0e3af99cc6e1c654
Closes: Coverity CID#188853
---
M src/select.c
1 file changed, 8 insertions(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/select.c b/src/select.c
index 0b115c6..b594ca5 100644
--- a/src/select.c
+++ b/src/select.c
@@ -324,11 +324,18 @@
 	ofd->when = BSC_FD_READ;
 
 	if (ofd->fd < 0) {
+		int rc;
+
 		ofd->fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK);
 		if (ofd->fd < 0)
 			return ofd->fd;
 
-		osmo_fd_register(ofd);
+		rc = osmo_fd_register(ofd);
+		if (rc < 0) {
+			close(ofd->fd);
+			ofd->fd = -1;
+			return rc;
+		}
 	}
 	return 0;
 }

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia2528cc3e3155bbc9cb32dee0e3af99cc6e1c654
Gerrit-Change-Number: 11413
Gerrit-PatchSet: 3
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181021/d2dc6104/attachment.htm>


More information about the gerrit-log mailing list