diff options
author | 2014-12-17 11:25:55 +0000 | |
---|---|---|
committer | 2014-12-18 11:02:34 +0200 | |
commit | a7b29afcef1f21a2001c711a44c935a556105a07 (patch) | |
tree | 078e2511d7ff50b465c4124cf8f2d5c786b365c3 | |
parent | 82747b38f94dd60eb1838dbcaf7f74d6467c3706 (diff) | |
download | nnn-a7b29afcef1f21a2001c711a44c935a556105a07.tar.gz |
regexec: check on success return code
on OpenBSD: "Other non-zero error codes may be returned in exceptional
situations; see DIAGNOSTICS" regcomp(3).
-rw-r--r-- | noice.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -189,7 +189,7 @@ openwith(char *file) if (regcomp(®ex, assocs[i].regex, REG_NOSUB | REG_EXTENDED) != 0) continue; - if (regexec(®ex, file, 0, NULL, 0) != REG_NOMATCH) { + if (regexec(®ex, file, 0, NULL, 0) == 0) { bin = assocs[i].bin; break; } @@ -219,7 +219,7 @@ setfilter(regex_t *regex, char *filter) int visible(regex_t *regex, char *file) { - if (regexec(regex, file, 0, NULL, 0) != REG_NOMATCH) + if (regexec(regex, file, 0, NULL, 0) == 0) return 1; return 0; } |