Code

store: Require name matchers to match string *and* regex if specified.
authorSebastian Harl <sh@tokkee.org>
Fri, 21 Feb 2014 02:07:11 +0000 (03:07 +0100)
committerSebastian Harl <sh@tokkee.org>
Fri, 21 Feb 2014 02:07:11 +0000 (03:07 +0100)
src/core/store_lookup.c

index 089b99fb125756a0712506f8de9fbe34bc7edab4..26e466617dc29244da13a770dcc465554b5b68fd 100644 (file)
@@ -126,12 +126,12 @@ match_name(name_matcher_t *m, const char *name)
        if (! name)
                name = "";
 
-       if (m->name && (! strcasecmp(m->name, name)))
-               return 0;
-       if (m->name_re && (! regexec(m->name_re, name,
-                                       /* matches */ 0, NULL, /* flags = */ 0)))
-               return 0;
-       return -1;
+       if (m->name && strcasecmp(m->name, name))
+               return -1;
+       if (m->name_re && regexec(m->name_re, name,
+                                       /* matches */ 0, NULL, /* flags = */ 0))
+               return -1;
+       return 0;
 } /* match_name */
 
 /* match attribute specific values;