From 9a6b442cee5f080f05e872b4406fbb2cb444797e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Mon, 21 Jul 2014 13:42:54 +0200 Subject: [PATCH] Fix non-blocking sockets in net_accept() --- ChangeLog | 1 + library/net.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index cb1be2679..68c437144 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ PolarSSL ChangeLog (Sorted per branch, date) Bugfix * Support escaping of commas in x509_string_to_names() * Fix compile error in ssl_pthread_server (found by Julian Ospald). + * Fix net_accept() regarding non-blocking sockets (found by Luca Pesce). Changes * Ciphersuites using SHA-256 or SHA-384 now require TLS 1.x (there is no diff --git a/library/net.c b/library/net.c index ad4b8921c..de1ec7502 100644 --- a/library/net.c +++ b/library/net.c @@ -434,7 +434,7 @@ int net_accept( int bind_fd, int *client_fd, void *client_ip ) 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 );