diff --git a/components/mbedtls/port/net.c b/components/mbedtls/port/net.c index bb0884ac8..459106b40 100644 --- a/components/mbedtls/port/net.c +++ b/components/mbedtls/port/net.c @@ -203,6 +203,8 @@ int mbedtls_net_bind( mbedtls_net_context *ctx, const char *bind_ip, const char */ static int net_would_block( const mbedtls_net_context *ctx ) { + int error = mbedtls_net_errno(ctx->fd); + /* * Never return 'WOULD BLOCK' on a non-blocking socket */ @@ -210,8 +212,6 @@ static int net_would_block( const mbedtls_net_context *ctx ) return ( 0 ); } - int error = mbedtls_net_errno(ctx->fd); - switch ( error ) { #if defined EAGAIN case EAGAIN: