[sheepdog] [PATCH] dog: fix improper typed 'ret' in 'vdi create'

Liu Yuan namei.unix at gmail.com
Tue Jan 21 14:49:00 CET 2014


'ret' is unsigned then never get < 0 even in error case, so for a wrong size, we
will proceed to create an invalid vdi.

Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 dog/vdi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dog/vdi.c b/dog/vdi.c
index 1afb37e..37b8ea5 100644
--- a/dog/vdi.c
+++ b/dog/vdi.c
@@ -596,8 +596,9 @@ static int vdi_create(int argc, char **argv)
 	uint64_t size;
 	uint32_t vid;
 	uint64_t oid;
-	uint32_t idx, max_idx, ret, nr_copies = vdi_cmd_data.nr_copies;
+	uint32_t idx, max_idx, nr_copies = vdi_cmd_data.nr_copies;
 	struct sd_inode *inode = NULL;
+	int ret;
 
 	if (!argv[optind]) {
 		sd_err("Please specify the VDI size");
-- 
1.8.1.2




More information about the sheepdog mailing list