From 446ee6618f2e428806f9e273a83d8118c0a63b56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Sat, 1 Feb 2014 10:02:32 +0100 Subject: [PATCH] Add LCOV_EXCLUDE_LINE on some IO errors --- library/ctr_drbg.c | 8 ++++---- library/hmac_drbg.c | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/library/ctr_drbg.c b/library/ctr_drbg.c index 99d120c73..d2b43137c 100644 --- a/library/ctr_drbg.c +++ b/library/ctr_drbg.c @@ -362,8 +362,8 @@ int ctr_drbg_write_seed_file( ctr_drbg_context *ctx, const char *path ) if( fwrite( buf, 1, CTR_DRBG_MAX_INPUT, f ) != CTR_DRBG_MAX_INPUT ) { - ret = POLARSSL_ERR_CTR_DRBG_FILE_IO_ERROR; - goto exit; + ret = POLARSSL_ERR_CTR_DRBG_FILE_IO_ERROR; /* LCOV_EXCL_LINE */ + goto exit; /* LCOV_EXCL_LINE */ } ret = 0; @@ -394,8 +394,8 @@ int ctr_drbg_update_seed_file( ctr_drbg_context *ctx, const char *path ) if( fread( buf, 1, n, f ) != n ) { - fclose( f ); - return( POLARSSL_ERR_CTR_DRBG_FILE_IO_ERROR ); + fclose( f ); /* LCOV_EXCL_LINE */ + return( POLARSSL_ERR_CTR_DRBG_FILE_IO_ERROR ); /* LCOV_EXCL_LINE */ } fclose( f ); diff --git a/library/hmac_drbg.c b/library/hmac_drbg.c index 3495d4979..f186b5c8e 100644 --- a/library/hmac_drbg.c +++ b/library/hmac_drbg.c @@ -291,7 +291,7 @@ void hmac_drbg_free( hmac_drbg_context *ctx ) #if defined(POLARSSL_FS_IO) int hmac_drbg_write_seed_file( hmac_drbg_context *ctx, const char *path ) { - int ret = POLARSSL_ERR_HMAC_DRBG_FILE_IO_ERROR; + int ret; FILE *f; unsigned char buf[ POLARSSL_HMAC_DRBG_MAX_INPUT ]; @@ -303,8 +303,8 @@ int hmac_drbg_write_seed_file( hmac_drbg_context *ctx, const char *path ) if( fwrite( buf, 1, sizeof( buf ), f ) != sizeof( buf ) ) { - ret = POLARSSL_ERR_HMAC_DRBG_FILE_IO_ERROR; - goto exit; + ret = POLARSSL_ERR_HMAC_DRBG_FILE_IO_ERROR; /* LCOV_EXCL_LINE */ + goto exit; /* LCOV_EXCL_LINE */ } ret = 0; @@ -335,8 +335,8 @@ int hmac_drbg_update_seed_file( hmac_drbg_context *ctx, const char *path ) if( fread( buf, 1, n, f ) != n ) { - fclose( f ); - return( POLARSSL_ERR_HMAC_DRBG_FILE_IO_ERROR ); + fclose( f ); /* LCOV_EXCL_LINE */ + return( POLARSSL_ERR_HMAC_DRBG_FILE_IO_ERROR ); /* LCOV_EXCL_LINE */ } fclose( f );