diff --git a/subsys/net/lib/sockets/sockets.c b/subsys/net/lib/sockets/sockets.c index 4c37f0cf04c..e39545ca8f5 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); }