1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-28 02:50:41 +03:00

vdo: fix --vdosettings parser

Parser was incorrectly parsing vdo_use_features - move the skip
of 'use_' prefix into internal loop which handles skipping of '_'.
This commit is contained in:
Zdenek Kabelac 2022-08-15 13:14:03 +02:00
parent fc5bc5985d
commit bba96e8680

View File

@ -1206,13 +1206,11 @@ out:
*/
static int _compare_vdo_option(const char *b1, const char *b2)
{
int use_skipped = 0;
if (strncasecmp(b1, "vdo", 3) == 0) // skip vdo prefix
b1 += 3;
if ((tolower(*b1) != tolower(*b2)) &&
(strncmp(b2, "use_", 4) == 0))
b2 += 4; // try again with skipped prefix 'use_'
while (*b1 && *b2) {
if (tolower(*b1) == tolower(*b2)) {
++b1;
@ -1224,8 +1222,14 @@ static int _compare_vdo_option(const char *b1, const char *b2)
++b1; // skip to next char
else if (*b2 == '_')
++b2; // skip to next char
else
else {
if (!use_skipped++ && (strncmp(b2, "use_", 4) == 0)) {
b2 += 4; // try again with skipped prefix 'use_'
continue;
}
break; // mismatch
}
}
return (*b1 || *b2) ? 0 : 1;