From 2f2f0211ffb1eacbb6c6a03d19338a7c6548dfae Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 2 May 2018 22:10:04 +0200 Subject: [SERVER] Don't spam log in vmdkLegacyMode for unknown images --- src/server/image.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/server/image.c b/src/server/image.c index 80beef7..338cf5a 100644 --- a/src/server/image.c +++ b/src/server/image.c @@ -843,6 +843,8 @@ static bool image_load(char *base, char *path, int withUplink) // Legacy mode enabled and no rid extracted from filename? if ( _vmdkLegacyMode && revision == -1 ) { + fdImage = open( path, O_RDONLY ); // Check if it exists + if ( fdImage == -1 ) goto load_error; // Yes, simply append full file name and set rid to 1 strcat( dst, fileName ); revision = 1; @@ -857,8 +859,10 @@ static bool image_load(char *base, char *path, int withUplink) existing = image_get( imgName, (uint16_t)revision, true ); // ### Now load the actual image related data ### - fdImage = open( path, O_RDONLY ); - if ( fdImage < 0 ) { + if ( fdImage == -1 ) { + fdImage = open( path, O_RDONLY ); + } + if ( fdImage == -1 ) { logadd( LOG_ERROR, "Could not open '%s' for reading...", path ); goto load_error; } @@ -999,7 +1003,7 @@ static bool image_load(char *base, char *path, int withUplink) function_return = true; // Clean exit: - load_error: ; +load_error: ; if ( existing != NULL ) existing = image_release( existing ); if ( crc32list != NULL ) free( crc32list ); if ( cache_map != NULL ) free( cache_map ); -- cgit v1.2.3-55-g7522