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
This commit is contained in:
Harald Welte 2021-01-30 11:36:20 +01:00
parent 4d40047c50
commit 335c550fab
1 changed files with 6 additions and 1 deletions

View File

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