diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-12-04 21:22:03 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-12-04 21:22:03 -0500 |
commit | 83cc57700f1e2c37c889279f724f0f51dcd9ffc5 (patch) | |
tree | 54f2265ac466ae5fc876ba61bec11029459efd97 | |
parent | 626b1945eb42f1d2b0a581673952a9b528210850 (diff) |
fixup! cmd_format: fix --version
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | c_src/tools-util.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/c_src/tools-util.c b/c_src/tools-util.c index 3df2b004..1a749858 100644 --- a/c_src/tools-util.c +++ b/c_src/tools-util.c @@ -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); } |