From 50fa67d36412c0d40ae5716b2b6fb0d083cb7d95 Mon Sep 17 00:00:00 2001 From: Andres Amaya Garcia Date: Wed, 5 Dec 2018 23:58:28 +0000 Subject: [PATCH] Fix bad practice use of exit_code in authcrypt --- authcrypt/main.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/authcrypt/main.cpp b/authcrypt/main.cpp index 842f66ac4..811fa084c 100644 --- a/authcrypt/main.cpp +++ b/authcrypt/main.cpp @@ -24,17 +24,18 @@ #include "mbedtls/platform.h" int main() { - int exit_code = MBEDTLS_EXIT_FAILURE; + int exit_code = MBEDTLS_EXIT_SUCCESS; + int ret; - if((exit_code = mbedtls_platform_setup(NULL)) != 0) { - printf("Platform initialization failed with error %d\n", exit_code); + if ((ret = mbedtls_platform_setup(NULL)) != 0) { + printf("Platform initialization failed with error %d\n", ret); return MBEDTLS_EXIT_FAILURE; } Authcrypt *authcrypt = new Authcrypt(); - if ((exit_code = authcrypt->run()) != 0) { - mbedtls_printf("Example failed with error %d\n", exit_code); + if ((ret = authcrypt->run()) != 0) { + mbedtls_printf("Example failed with error %d\n", ret); exit_code = MBEDTLS_EXIT_FAILURE; }