laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/22551 )

Change subject: ns2: Use proper return value from write_queue callback function
......................................................................

ns2: Use proper return value from write_queue callback function

write_queue expects a -errno value on error, not '-1'.

Change-Id: I93c858facfe7e1c533df8dccc4502a574686bc8a
Related: OS#4995
---
M src/gb/gprs_ns2_fr.c
1 file changed, 6 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  lynxis lazus: Looks good to me, approved



diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index 1c88db6..f73033b 100644
--- a/src/gb/gprs_ns2_fr.c
+++ b/src/gb/gprs_ns2_fr.c
@@ -247,7 +247,12 @@

 static int handle_netif_write(struct osmo_fd *ofd, struct msgb *msg)
 {
-       return write(ofd->fd, msgb_data(msg), msgb_length(msg));
+       int rc = write(ofd->fd, msgb_data(msg), msgb_length(msg));
+       /* write_queue expects a "-errno" type return value in case of failure 
*/
+       if (rc == -1)
+               return -errno;
+       else
+               return rc;
 }

 /*! determine if given bind is for FR-GRE encapsulation. */

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/22551
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I93c858facfe7e1c533df8dccc4502a574686bc8a
Gerrit-Change-Number: 22551
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <lafo...@osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <lafo...@osmocom.org>
Gerrit-Reviewer: lynxis lazus <lyn...@fe80.eu>
Gerrit-CC: daniel <dwillm...@sysmocom.de>
Gerrit-MessageType: merged

Reply via email to