laforge has uploaded this change for review.
osmo_io: Don't pretend to support backends without close_cb
Let's not pretend we support backends without a close_cb. In such
situations nobody would actually close(2) the file descriptor,
but we would set iofd->fd to -1, effectively creating a file descriptor
leak.
Both of our two back-ends provide a close_cb, and we don't need to
consider hypothetical future back-ends that would not like to register
such a call-back.
Related: OS#6393
Change-Id: Id285f1d7b73ae5805aa618897016ae8b73bf892d
---
M src/core/osmo_io.c
1 file changed, 21 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/91/36191/1
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index 0e0a468..e4807e5 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -781,8 +781,8 @@
iofd->pending = NULL;
- if (osmo_iofd_ops.close)
- rc = osmo_iofd_ops.close(iofd);
+ OSMO_ASSERT(osmo_iofd_ops.close);
+ rc = osmo_iofd_ops.close(iofd);
iofd->fd = -1;
return rc;
}
To view, visit change 36191. To unsubscribe, or for help writing mail filters, visit settings.