osmo_io_poll: Use -errno as result on read error

Related: OS#5751
Change-Id: Ida63b74feecddf96bab7b2ade4e9ad216fe56e06
This commit is contained in:
Andreas Eversberg 2024-02-14 14:33:10 +01:00
parent 4f01ae3d62
commit 44b378ce13
2 changed files with 2 additions and 1 deletions

View File

@ -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)
{

View File

@ -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))