msuraev has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmo-netif/+/29555 )

Change subject: Better handling of send() error
......................................................................

Better handling of send() error

Avoid logging confusion when -1 == ENOTSUP.

Change-Id: Iaa7e16e717c56466c5d9a64deb438776ca88022e
---
M src/stream.c
1 file changed, 5 insertions(+), 4 deletions(-)

Approvals:
  fixeria: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/stream.c b/src/stream.c
index 8cb3ad0..7b41ce1 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -1328,11 +1328,12 @@
                }
                break;
        default:
-               ret = -ENOTSUP;
+               ret = -1;
+               errno = ENOTSUP;
        }
-       if (ret < 0) { /* send(): On error , -1 is returned, and errno is set 
appropriately */
-               LOGP(DLINP, LOGL_ERROR, "error to send: %s\n", (ret == -1) ? 
strerror(errno) : strerror(-ret));
-       }
+       if (ret == -1) /* send(): On error -1 is returned, and errno is set 
appropriately */
+               LOGP(DLINP, LOGL_ERROR, "error to send: %s\n", strerror(errno));
+
        msgb_free(msg);

        if (llist_empty(&conn->tx_queue) && (conn->flags & 
OSMO_STREAM_SRV_F_FLUSH_DESTROY))

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

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Iaa7e16e717c56466c5d9a64deb438776ca88022e
Gerrit-Change-Number: 29555
Gerrit-PatchSet: 3
Gerrit-Owner: msuraev <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: msuraev <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to