pespin has uploaded this change for review.
stream: Unset fd value after close() before calling closed_cb()
The fd is not valid anymore after close() call, so let's set it to a
clearly invalid value, to avoid confusion on closed_cb() users
attempting to use the fd get info about the socket at that time.
Change-Id: I82d9bdfb38cf5e9f689eca0d9a4c19ddd5541af7
---
M src/stream.c
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/35/29335/1
diff --git a/src/stream.c b/src/stream.c
index f090c4f..bc209af 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -1439,8 +1439,9 @@
* \param[in] conn Stream Server to be destroyed */
void osmo_stream_srv_destroy(struct osmo_stream_srv *conn)
{
- close(conn->ofd.fd);
osmo_fd_unregister(&conn->ofd);
+ close(conn->ofd.fd);
+ conn->ofd.fd = -1;
if (conn->closed_cb)
conn->closed_cb(conn);
msgb_queue_free(&conn->tx_queue);
To view, visit change 29335. To unsubscribe, or for help writing mail filters, visit settings.