From 8ac2f96ca6c97307b9a9253008e318f55aceb4d9 Mon Sep 17 00:00:00 2001 From: Christian Taedcke Date: Mon, 15 Jun 2020 17:00:05 +0200 Subject: [PATCH] net: sockets: fix conn_handler check in zsock_getsockname_ctx The check was inverted, so a bound socket was detected as not bound. Signed-off-by: Christian Taedcke --- subsys/net/lib/sockets/sockets.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/lib/sockets/sockets.c b/subsys/net/lib/sockets/sockets.c index 4c37f0cf04..e39545ca8f 100644 --- a/subsys/net/lib/sockets/sockets.c +++ b/subsys/net/lib/sockets/sockets.c @@ -1599,7 +1599,7 @@ int zsock_getsockname_ctx(struct net_context *ctx, struct sockaddr *addr, socklen_t newlen = 0; /* If we don't have a connection handler, the socket is not bound */ - if (ctx->conn_handler) { + if (!ctx->conn_handler) { SET_ERRNO(-EINVAL); }