From 01e3d21350265b1b0236d79c0f6854572c8e8fae Mon Sep 17 00:00:00 2001 From: Andres Amaya Garcia Date: Sun, 29 Apr 2018 21:58:53 +0100 Subject: [PATCH] Fix ret code in udp_proxy.c --- programs/test/udp_proxy.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/programs/test/udp_proxy.c b/programs/test/udp_proxy.c index 20624d227..b56bd2110 100644 --- a/programs/test/udp_proxy.c +++ b/programs/test/udp_proxy.c @@ -37,10 +37,12 @@ #include #include #include -#define mbedtls_time time -#define mbedtls_time_t time_t -#define mbedtls_printf printf -#endif +#define mbedtls_time time +#define mbedtls_time_t time_t +#define mbedtls_printf printf +#define MBEDTLS_EXTI_SUCCESS EXIT_SUCCESS +#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE +#endif /* MBEDTLS_PLATFORM_C */ #if !defined(MBEDTLS_NET_C) int main( void ) @@ -468,7 +470,8 @@ int handle_message( const char *way, int main( int argc, char *argv[] ) { - int ret; + int ret = 1; + int exit_code = MBEDTLS_EXIT_FAILURE; mbedtls_net_context listen_fd, client_fd, server_fd; @@ -591,10 +594,12 @@ accept: } } + exit_code = MBEDTLS_EXIT_SUCCESS; + exit: #ifdef MBEDTLS_ERROR_C - if( ret != 0 ) + if( exit_code != MBEDTLS_EXIT_SUCCESS ) { char error_buf[100]; mbedtls_strerror( ret, error_buf, 100 ); @@ -612,7 +617,7 @@ exit: fflush( stdout ); getchar(); #endif - return( ret != 0 ); + return( exit_code ); } #endif /* MBEDTLS_NET_C */