Fix ret code in pem2der.c

This commit is contained in:
Andres Amaya Garcia 2018-04-29 22:08:41 +01:00
parent 357b0b283a
commit 78dabe07bf

View file

@ -29,10 +29,13 @@
#include "mbedtls/platform.h"
#else
#include <stdio.h>
#define mbedtls_free free
#define mbedtls_calloc calloc
#define mbedtls_printf printf
#endif
#include <stdlib.h>
#define mbedtls_free free
#define mbedtls_calloc calloc
#define mbedtls_printf printf
#define MBEDTLS_EXTI_SUCCESS EXIT_SUCCESS
#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
#endif /* MBEDTLS_PLATFORM_C */
#if defined(MBEDTLS_BASE64_C) && defined(MBEDTLS_FS_IO)
#include "mbedtls/error.h"
@ -178,7 +181,8 @@ static int write_file( const char *path, unsigned char *buf, size_t n )
int main( int argc, char *argv[] )
{
int ret = 0;
int ret = 1;
int exit_code = MBEDTLS_EXIT_FAILURE;
unsigned char *pem_buffer = NULL;
unsigned char der_buffer[4096];
char buf[1024];
@ -273,6 +277,8 @@ int main( int argc, char *argv[] )
mbedtls_printf( " ok\n" );
exit_code = MBEDTLS_EXIT_SUCCESS;
exit:
free( pem_buffer );
@ -281,6 +287,6 @@ exit:
fflush( stdout ); getchar();
#endif
return( ret );
return( exit_code );
}
#endif /* MBEDTLS_BASE64_C && MBEDTLS_FS_IO */