Change in libosmocore[master]: ns2: Use proper return value from write_queue callback function

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Mon Feb 1 08:32:09 UTC 2021


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 <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-CC: daniel <dwillmann at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210201/b7daee2e/attachment.htm>


More information about the gerrit-log mailing list