From a2df22f1e938bbce844b75801106806b56c778b5 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sun, 8 Jul 2007 12:37:13 -0400 Subject: [PATCH] Stop after the second '.' when parsing version numbers Now that we are moving to x.y.z version number scheme for maintenance releases, we ned to change ext2fs_parse_version_string and blkid_parse_version_string to ignore the second period so we don't have maintenance releases with a substantially bigger verison number than the initial x.y release. Signed-off-by: "Theodore Ts'o" --- lib/ext2fs/version.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/ext2fs/version.c b/lib/ext2fs/version.c index f59ce87..3fc4c73 100644 --- a/lib/ext2fs/version.c +++ b/lib/ext2fs/version.c @@ -27,11 +27,15 @@ static const char *lib_date = E2FSPROGS_DATE; int ext2fs_parse_version_string(const char *ver_string) { const char *cp; - int version = 0; + int version = 0, dot_count = 0; for (cp = ver_string; *cp; cp++) { - if (*cp == '.') - continue; + if (*cp == '.') { + if (dot_count++) + break; + else + continue; + } if (!isdigit(*cp)) break; version = (version * 10) + (*cp - '0'); -- 1.8.3.1