Skip to content

Commit 50fa67d

Browse files
author
Andres Amaya Garcia
committed
Fix bad practice use of exit_code in authcrypt
1 parent b16a513 commit 50fa67d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

authcrypt/main.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,18 @@
2424
#include "mbedtls/platform.h"
2525

2626
int main() {
27-
int exit_code = MBEDTLS_EXIT_FAILURE;
27+
int exit_code = MBEDTLS_EXIT_SUCCESS;
28+
int ret;
2829

29-
if((exit_code = mbedtls_platform_setup(NULL)) != 0) {
30-
printf("Platform initialization failed with error %d\n", exit_code);
30+
if ((ret = mbedtls_platform_setup(NULL)) != 0) {
31+
printf("Platform initialization failed with error %d\n", ret);
3132
return MBEDTLS_EXIT_FAILURE;
3233
}
3334

3435
Authcrypt *authcrypt = new Authcrypt();
3536

36-
if ((exit_code = authcrypt->run()) != 0) {
37-
mbedtls_printf("Example failed with error %d\n", exit_code);
37+
if ((ret = authcrypt->run()) != 0) {
38+
mbedtls_printf("Example failed with error %d\n", ret);
3839
exit_code = MBEDTLS_EXIT_FAILURE;
3940
}
4041

0 commit comments

Comments
 (0)