commit 306560e3dbc8602dfbd44bc5c4abdd650fc4fdaa
parent 9ad57d03f120e0d6f9751bb8105cbd2da19c5bd0
Author: sin <sin@2f30.org>
Date: Thu, 22 Aug 2013 18:56:36 +0100
Explicitly check for REG_NOMATCH
Diffstat:
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/smdev.c b/smdev.c
@@ -132,10 +132,9 @@ matchrule(int ruleidx, char *devname)
pregcache[ruleidx].cached = 1;
}
match = &pregcache[ruleidx].preg;
-
ret = regexec(match, devname, 1, &off, 0);
-
- if (ret || off.rm_so || off.rm_eo != strlen(devname))
+ if (ret == REG_NOMATCH || off.rm_so ||
+ off.rm_eo != strlen(devname))
return -1;
return 0;
}