From: Theodore Ts'o Date: Sun, 8 Jul 2007 16:37:13 +0000 (-0400) Subject: Stop after the second '.' when parsing version numbers X-Git-Tag: v1.40.1~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a2df22f1e938bbce844b75801106806b56c778b5;p=thirdparty%2Fe2fsprogs.git 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" --- diff --git a/lib/ext2fs/version.c b/lib/ext2fs/version.c index f59ce8795..3fc4c73c5 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');