mirror of https://gerrit.osmocom.org/libosmocore
osmo_io_poll: Use -errno as result on read error
Related: OS#5751 Change-Id: Ida63b74feecddf96bab7b2ade4e9ad216fe56e06
This commit is contained in:
parent
2ce17dab2b
commit
76f7678cb1
|
@ -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
|
/*! 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] 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] 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 */
|
* \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)
|
void iofd_handle_recv(struct osmo_io_fd *iofd, struct msgb *msg, int rc, struct iofd_msghdr *hdr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -74,7 +74,7 @@ static void iofd_poll_ofd_cb_recvmsg_sendmsg(struct osmo_fd *ofd, unsigned int w
|
||||||
if (rc > 0)
|
if (rc > 0)
|
||||||
msgb_put(msg, rc);
|
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))
|
if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_CLOSED))
|
||||||
|
|
Loading…
Reference in New Issue