Fix net_accept() regarding non-blocking sockets
diff --git a/ChangeLog b/ChangeLog
index deddb4c..9d0821c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,7 @@
    * x509_crt_parse() did not increase total_failed on PEM error
    * Fix compiler warnings on iOS (found by Sander Niemeijer).
    * Don't print uninitialised buffer in ssl_mail_client (found by Marc Abel).
+   * Fix net_accept() regarding non-blocking sockets (found by Luca Pesce).
 
 Changes
    * X.509 certificates with more than one AttributeTypeAndValue per
diff --git a/library/net.c b/library/net.c
index 899cf37..bfe08fb 100644
--- a/library/net.c
+++ b/library/net.c
@@ -282,7 +282,7 @@
 
     if( *client_fd < 0 )
     {
-        if( net_would_block( *client_fd ) != 0 )
+        if( net_would_block( bind_fd ) != 0 )
             return( POLARSSL_ERR_NET_WANT_READ );
 
         return( POLARSSL_ERR_NET_ACCEPT_FAILED );