Check additional return values in some test cases

This commit is contained in:
Paul Bakker 2014-04-17 16:08:20 +02:00
parent 94b916c7b5
commit 8a0c0a9ed9
3 changed files with 13 additions and 3 deletions

View file

@ -146,7 +146,12 @@ int main( int argc, char *argv[] )
printf( " failed\n ! fopen returned NULL\n" );
goto exit;
}
fgets( buf, sizeof(buf), f );
if( fgets( buf, sizeof(buf), f ) == NULL )
{
fclose( f );
printf( "Error: fgets() failed to retrieve password\n" );
goto exit;
}
fclose( f );
i = (int) strlen( buf );