]> xenbits.xensource.com Git - xen.git/commitdiff
libxl: only check size of regular files when validating a virtual disk
authorIan Campbell <ian.campbell@citrix.com>
Wed, 26 Jan 2011 11:47:52 +0000 (11:47 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 26 Jan 2011 11:47:52 +0000 (11:47 +0000)
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>
tools/libxl/libxl.c

index 6fee2b1a604cf5d597329e9ef5faaf6dda6dc83c..ccbc84218bae891a93c5611784d9263f06bf1548 100644 (file)
@@ -850,7 +850,7 @@ static int validate_virtual_disk(libxl_ctx *ctx, char *file_name, libxl_disk_phy
                 file_name);
             return ERROR_INVAL;
         }
-    } else if ( stat_buf.st_size == 0 ) {
+    } else if ( S_ISREG(stat_buf.st_mode) && stat_buf.st_size == 0 ) {
         LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Virtual disk %s size is 0!\n", file_name);
         return ERROR_INVAL;
     }