debuggers.hg

changeset 22864:00e1fd80e1f7

libxl: only check size of regular files when validating a virtual disk

st_size is only valid for regular files and not block devices.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Ian Campbell <ian.campbell@citrix.com>
date Wed Jan 26 11:47:52 2011 +0000 (2011-01-26)
parents 16c863cb99f2
children 67d5b8004947
files tools/libxl/libxl.c
line diff
     1.1 --- a/tools/libxl/libxl.c	Wed Jan 26 08:56:44 2011 +0000
     1.2 +++ b/tools/libxl/libxl.c	Wed Jan 26 11:47:52 2011 +0000
     1.3 @@ -850,7 +850,7 @@ static int validate_virtual_disk(libxl_c
     1.4                  file_name);
     1.5              return ERROR_INVAL;
     1.6          }
     1.7 -    } else if ( stat_buf.st_size == 0 ) {
     1.8 +    } else if ( S_ISREG(stat_buf.st_mode) && stat_buf.st_size == 0 ) {
     1.9          LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Virtual disk %s size is 0!\n", file_name);
    1.10          return ERROR_INVAL;
    1.11      }