aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2021-01-30 11:36:20 +0100
committerHarald Welte <laforge@osmocom.org>2021-01-30 17:59:51 +0100
commit335c550fab46143a20f30f92b8c74d84c5eb0de8 (patch)
treefc3b7c4071673444b8dca0071cc9c60e9df0045e /src
parent4d40047c50ef916e6b1a38bd77567bc1b4857122 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/gb/gprs_ns2_fr.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index 1c88db63..f73033b4 100644
--- a/src/gb/gprs_ns2_fr.c
+++ b/src/gb/gprs_ns2_fr.c
@@ -247,7 +247,12 @@ static int fr_dlci_rx_cb(void *cb_data, struct msgb *msg)
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. */