From 65d2ef197fd238eb7980b2cfb0e5d29d77861cbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20H=C3=A4ggstr=C3=B6m?= Date: Tue, 20 Nov 2018 17:23:00 +0100 Subject: [PATCH] Check both type *and* pattern if invert is given --- rofs-filtered.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rofs-filtered.c b/rofs-filtered.c index 848e3ed..79069ac 100644 --- a/rofs-filtered.c +++ b/rofs-filtered.c @@ -403,10 +403,13 @@ static int should_hide(const char *name, mode_t mode) { for (int i = 0; i < modes_count; ++i) if (mode == modes[i]) { log_msg(LOG_DEBUG, "type: %07o %s", mode, name); + if (conf.invert) + goto allow_type; return !conf.invert; } if (conf.invert && mode != S_IFREG && mode != S_IFDIR) return conf.invert; + allow_type: if (!regexec(&pattern, name, 0, NULL, 0)) { // We have a match. log_msg(LOG_DEBUG, "match: %s", name);