fixup! cmd_format: fix --version

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2024-12-04 21:22:03 -05:00
parent 626b1945eb
commit 83cc57700f

View File

@ -734,9 +734,16 @@ unsigned version_parse(char *buf)
unsigned major, minor;
if (kstrtouint(major_str, 10, &major) ||
kstrtouint(minor_str, 10, &minor))
die("invalid version");
if (!minor_str) {
major = 0;
if (kstrtouint(major_str, 10, &minor))
die("invalid version %s", buf);
} else {
if (kstrtouint(major_str, 10, &major) ||
kstrtouint(minor_str, 10, &minor))
die("invalid version %s", buf);
}
return BCH_VERSION(major, minor);
}