From ac61645c2d771128cd3649748a740675463b33b8 Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Mon, 12 Nov 2001 17:06:33 +0000 Subject: [PATCH] o if any pattern rejects a device, and there were no accepts then reject ! --- lib/device/dev-cache.c | 2 +- lib/filters/filter-regex.c | 9 +++++---- old-tests/filters/pfilter_t.c | 2 +- old-tests/filters/rfilter_t.c | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c index dc68667a3..d9507cff7 100644 --- a/lib/device/dev-cache.c +++ b/lib/device/dev-cache.c @@ -237,7 +237,7 @@ static int _insert(const char *path, int rec) } else { /* add a device */ if (!S_ISBLK(info.st_mode)) { - log_debug("%s: Not a block device", path); + //log_debug("%s: Not a block device", path); return 0; } diff --git a/lib/filters/filter-regex.c b/lib/filters/filter-regex.c index e90224d6c..bc8958aaa 100644 --- a/lib/filters/filter-regex.c +++ b/lib/filters/filter-regex.c @@ -150,7 +150,7 @@ static int _build_matcher(struct rfilter *rf, struct config_value *val) static int _accept_p(struct dev_filter *f, struct device *dev) { struct list *ah; - int m, first = 1; + int m, first = 1, rejected = 0; struct rfilter *rf = (struct rfilter *) f->private; struct str_list *sl; @@ -168,8 +168,9 @@ static int _accept_p(struct dev_filter *f, struct device *dev) return 1; } - } else - return 1; + + rejected = 1; + } first = 0; } @@ -178,7 +179,7 @@ static int _accept_p(struct dev_filter *f, struct device *dev) * pass everything that doesn't match * anything. */ - return 1; + return !rejected; } static void _destroy(struct dev_filter *f) diff --git a/old-tests/filters/pfilter_t.c b/old-tests/filters/pfilter_t.c index 8e87f657b..33d5536e9 100644 --- a/old-tests/filters/pfilter_t.c +++ b/old-tests/filters/pfilter_t.c @@ -99,7 +99,7 @@ int main(int argc, char **argv) } while ((dev = dev_iter_get(iter))) - printf("%s\n", dev->name); + printf("%s\n", dev_name(dev)); dev_iter_destroy(iter); pfilter->destroy(pfilter); diff --git a/old-tests/filters/rfilter_t.c b/old-tests/filters/rfilter_t.c index 2a917a5c7..3288907c3 100644 --- a/old-tests/filters/rfilter_t.c +++ b/old-tests/filters/rfilter_t.c @@ -70,7 +70,7 @@ int main(int argc, char **argv) } while ((dev = dev_iter_get(iter))) - printf("%s\n", dev->name); + printf("%s\n", dev_name(dev)); dev_iter_destroy(iter); filter->destroy(filter);