[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] libxl: only check size of regular files when validating a virtual disk



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1296042472 0
# Node ID 00e1fd80e1f7a9c14f86020ed24fcbc35c772606
# Parent  16c863cb99f253bcc404a381920b46e9389484bd
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@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -r 16c863cb99f2 -r 00e1fd80e1f7 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Wed Jan 26 08:56:44 2011 +0000
+++ b/tools/libxl/libxl.c       Wed Jan 26 11:47:52 2011 +0000
@@ -850,7 +850,7 @@ static int validate_virtual_disk(libxl_c
                 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;
     }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.