X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lib%2Fext2fs%2Fversion.c;h=f8c8acfc3a6061f985c255c898eaedf10ec06122;hb=336c440ccea8f94b0728f881cddee84f730e7cc7;hp=c0e63518718c2a04d31d81a8c1e9df6696be6a55;hpb=5953b9de9ce59661640f851b217421d734bb0302;p=tools%2Fe2fsprogs.git diff --git a/lib/ext2fs/version.c b/lib/ext2fs/version.c index c0e6351..f8c8acf 100644 --- a/lib/ext2fs/version.c +++ b/lib/ext2fs/version.c @@ -4,11 +4,12 @@ * Copyright (C) 1997 Theodore Ts'o. * * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. + * This file may be redistributed under the terms of the GNU Library + * General Public License, version 2. * %End-Header% */ +#include "config.h" #if HAVE_UNISTD_H #include #endif @@ -16,12 +17,7 @@ #include #include -#if EXT2_FLAT_INCLUDES #include "ext2_fs.h" -#else -#include -#endif - #include "ext2fs.h" #include "../../version.h" @@ -32,11 +28,17 @@ 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 == '.') { + if (dot_count++) + break; + else + continue; + } if (!isdigit(*cp)) - continue; + break; version = (version * 10) + (*cp - '0'); } return version;