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
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. */