aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2024-02-14 14:33:10 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2024-02-28 16:43:03 +0100
commit76f7678cb1bfcc3eba79c17b566dda65417d211b (patch)
tree1f7d99d06afa1a705ffc58e8c722b0f6d33f2f34
parent2ce17dab2b8a3ff2e6528527fa541eb9995e6327 (diff)
osmo_io_poll: Use -errno as result on read error
-rw-r--r--src/core/osmo_io.c1
-rw-r--r--src/core/osmo_io_poll.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index 472edf9f..b6b59087 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -330,6 +330,7 @@ void iofd_handle_segmented_read(struct osmo_io_fd *iofd, struct msgb *msg, int r
/*! completion handler: Called by osmo_io backend after a given I/O operation has completed
* \param[in] iofd I/O file-descriptor on which I/O has completed
* \param[in] msg message buffer containing data related to completed I/O
+ * \param[in] rc result code with read size or error (-errno)
* \param[in] hdr serialized msghdr containing state of completed I/O */
void iofd_handle_recv(struct osmo_io_fd *iofd, struct msgb *msg, int rc, struct iofd_msghdr *hdr)
{
diff --git a/src/core/osmo_io_poll.c b/src/core/osmo_io_poll.c
index 52e806d2..74f137b0 100644
--- a/src/core/osmo_io_poll.c
+++ b/src/core/osmo_io_poll.c
@@ -74,7 +74,7 @@ static void iofd_poll_ofd_cb_recvmsg_sendmsg(struct osmo_fd *ofd, unsigned int w
if (rc > 0)
msgb_put(msg, rc);
- iofd_handle_recv(iofd, msg, rc, &hdr);
+ iofd_handle_recv(iofd, msg, (rc < 0 && errno > 0) ? -errno : rc, &hdr);
}
if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_CLOSED))