1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
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 <linux/aufs_type.h>
+#include <regex.h>
#include <stdio.h>
#include <string.h>
#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"
|