From 44b378ce13b8e91a3995d5f6e3c5502a33da559b Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Wed, 14 Feb 2024 14:33:10 +0100 Subject: [PATCH] osmo_io_poll: Use -errno as result on read error Related: OS#5751 Change-Id: Ida63b74feecddf96bab7b2ade4e9ad216fe56e06 --- src/core/osmo_io.c | 1 + src/core/osmo_io_poll.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c index b0e023ad6..61d264104 100644 --- a/src/core/osmo_io.c +++ b/src/core/osmo_io.c @@ -326,6 +326,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 fea8d641f..05f647c2a 100644 --- a/src/core/osmo_io_poll.c +++ b/src/core/osmo_io_poll.c @@ -73,7 +73,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))