diff --git a/ver.c b/ver.c index 1225bf6..921005f 100644 --- a/ver.c +++ b/ver.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Junjiro R. Okajima + * Copyright (C) 2011 Junjiro R. Okajima * * This program, aufs is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,15 +17,20 @@ */ #include +#include #include #include #include "au_util.h" int main(int argc, char *argv[]) { - if (!strncmp(AUFS_VERSION, "3.0", 3) - && (sizeof(AUFS_VERSION) - 1 == 3 - || AUFS_VERSION[3] == '-')) + regex_t preg; + const char *pat = "^3\\.[01](-|$)"; + + if (regcomp(&preg, pat, REG_EXTENDED | REG_NOSUB)) + AuFin("regcomp"); + + if (!regexec(&preg, AUFS_VERSION, 0, NULL, 0)) return 0; puts("Wrong version!\n"