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

[lvm-devel] [LVM2 PATCH] Fix 'lvconvert -s' to work again



Hi,

In current CVS head, 'lvconvert -s' doesn't work.
 # lvconvert -s testvg/lvol0 testvg/lvol1
 --snapshots argument cannot be mixed with --mirrors or --log
 lvconvert: Change logical volume layout

This is due to the lvconvert parameter check uses
'count' variable uninitialized for non-mirror case.
        int count;
...
        if (arg_count(cmd, log_ARG) || arg_count(cmd, mirrors_ARG))
                count = 1;
        count += arg_count(cmd, snapshot_ARG);

While the code around the _read_params() could be tidied up
some more, I hope this fix is included for now.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America
'count' is later used uninitialized.
As a result, 'lvconvert -s' always fails:
 # lvconvert -s testvg/lvol0 testvg/lvol1
 --snapshots argument cannot be mixed with --mirrors or --log
 lvconvert: Change logical volume layout


Index: LVM2.work/tools/lvconvert.c
===================================================================
--- LVM2.work.orig/tools/lvconvert.c
+++ LVM2.work/tools/lvconvert.c
@@ -101,7 +101,7 @@ static int _lvconvert_name_params(struct
 static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd,
 			int argc, char **argv)
 {
-	int count;
+	int count = 0;
 	int region_size;
 	int pagesize = lvm_getpagesize();
 

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