Fix missing return statement ssl_server2 idling
Also, introduce MBEDTLS_EINTR locally in net_sockets.c
for the platform-dependent return code macro used by
the `select` call to indicate that the poll was interrupted
by a signal handler: On Unix, the corresponding macro is EINTR,
while on Windows, it's WSAEINTR.
diff --git a/library/net_sockets.c b/library/net_sockets.c
index 96cfa35..10b5456 100644
--- a/library/net_sockets.c
+++ b/library/net_sockets.c
@@ -45,6 +45,8 @@
#if (defined(_WIN32) || defined(_WIN32_WCE)) && !defined(EFIX64) && \
!defined(EFI32)
+#define MBEDTLS_EINTR WSAEINTR
+
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
@@ -82,6 +84,8 @@
#include <netdb.h>
#include <errno.h>
+#define MBEDTLS_EINTR EINTR
+
#endif /* ( _WIN32 || _WIN32_WCE ) && !EFIX64 && !EFI32 */
/* Some MS functions want int and MSVC warns if we pass size_t,
@@ -475,12 +479,7 @@
ret = select( fd + 1, &read_fds, &write_fds, NULL,
timeout == (uint32_t) -1 ? NULL : &tv );
}
-#if ( defined(_WIN32) || defined(_WIN32_WCE) ) && !defined(EFIX64) && \
- !defined(EFI32)
- while( ret == WSAEINTR );
-#else
- while( ret == EINTR );
-#endif
+ while( ret == MBEDTLS_EINTR );
if( ret < 0 )
return( MBEDTLS_ERR_NET_POLL_FAILED );
diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c
index 232dc64..58f12c9 100644
--- a/programs/ssl/ssl_client2.c
+++ b/programs/ssl/ssl_client2.c
@@ -462,7 +462,7 @@
poll_type = MBEDTLS_NET_POLL_READ;
#if !defined(MBEDTLS_TIMING_C)
else
- return;
+ return( 0 );
#endif
while( 1 )
diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c
index 3a6b9dc..ed38a32 100644
--- a/programs/ssl/ssl_server2.c
+++ b/programs/ssl/ssl_server2.c
@@ -863,7 +863,7 @@
poll_type = MBEDTLS_NET_POLL_READ;
#if !defined(MBEDTLS_TIMING_C)
else
- return;
+ return( 0 );
#endif
while( 1 )