1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

cleanup: condition reodering

Check SEG_CANNOT_BE_ZEROED before even calling arg_str_value which
is not needed in this case.

Set it to 1 or 0 and not just result of strcmp call.
This commit is contained in:
Zdenek Kabelac 2014-02-11 13:42:32 +01:00
parent bcd6b643be
commit f86e18bfeb

View File

@ -1003,13 +1003,13 @@ static int _lvcreate_params(struct lvcreate_params *lp,
/*
* Should we zero/wipe signatures on the lv.
*/
lp->zero = strcmp(arg_str_value(cmd, zero_ARG,
(lp->segtype->flags & SEG_CANNOT_BE_ZEROED) ? "n" : "y"), "n");
lp->zero = (!(lp->segtype->flags & SEG_CANNOT_BE_ZEROED) &&
(strcmp(arg_str_value(cmd, zero_ARG, "y"), "y") == 0)) ? 1 : 0;
if (arg_count(cmd, wipesignatures_ARG)) {
/* If -W/--wipesignatures is given on command line directly, respect it. */
lp->wipe_signatures = strcmp(arg_str_value(cmd, wipesignatures_ARG,
(lp->segtype->flags & SEG_CANNOT_BE_ZEROED) ? "n" : "y"), "n");
lp->wipe_signatures =(!(lp->segtype->flags & SEG_CANNOT_BE_ZEROED) &&
(strcmp(arg_str_value(cmd, wipesignatures_ARG, "y"), "y") == 0)) ? 1 : 0;
} else {
/*
* If -W/--wipesignatures is not given on command line,