falconia has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/39276?usp=email ) Change subject: osmo_iofd_register: fix the case of changing fd ...................................................................... osmo_iofd_register: fix the case of changing fd Doxygen description for this function states: \param[in] fd the system fd number that will be registered. If you did not yet specify the file descriptor number during osmo_fd_setup(), or if it has changed since then, you can state the [new] file descriptor number as argument. If you wish to proceed with the previously specified file descriptor number, pass -1. However, the case where a new fd is passed to osmo_iofd_register() while the structure contains an old (but unregistered) fd was not handled correctly: the code would proceed with re-registering the old fd, ignoring the newly passed one. Change-Id: If8b8486ad7934afa203dfe1e996c9217373a017b --- M src/core/osmo_io.c 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/39276/1 diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c index e109cdf..1e3e114 100644 --- a/src/core/osmo_io.c +++ b/src/core/osmo_io.c @@ -753,13 +753,13 @@ } if (fd < 0) fd = iofd->fd; - else if (iofd->fd < 0) - iofd->fd = fd; if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_FD_REGISTERED)) { /* If re-registering same fd, handle as NO-OP. * New FD should go through unregister() first. */ return iofd->fd == fd ? 0 : -ENOTSUP; + } else { + iofd->fd = fd; } rc = osmo_iofd_ops.register_fd(iofd); -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/39276?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: If8b8486ad7934afa203dfe1e996c9217373a017b Gerrit-Change-Number: 39276 Gerrit-PatchSet: 1 Gerrit-Owner: falconia <falcon@freecalypso.org>