Whamcloud - gitweb
Stop after the second '.' when parsing version numbers
authorTheodore Ts'o <tytso@mit.edu>
Sun, 8 Jul 2007 16:37:13 +0000 (12:37 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 8 Jul 2007 16:37:13 +0000 (12:37 -0400)
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" <tytso@mit.edu>
lib/ext2fs/version.c

index f59ce87..3fc4c73 100644 (file)
@@ -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');