From 9e4bbeb95f5c9d046b671070eb35b3aa6f3ec5e6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bj=C3=B6rn=20Steinbrink?= Date: Wed, 5 Dec 2007 16:11:24 +0100 Subject: [PATCH] git config: Don't rely on regexec() returning 1 on non-match MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Some systems don't return 1 from regexec() when the pattern does not match (notably HP-UX which returns 20). Bug identified by Dscho and H.Merijn Brand. Signed-off-by: Björn Steinbrink Tested-by: H.Merijn Brand Cc: Johannes Schindelin Signed-off-by: Junio C Hamano --- builtin-config.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/builtin-config.c b/builtin-config.c index 4c9ded3b1a..6175dc3738 100644 --- a/builtin-config.c +++ b/builtin-config.c @@ -38,8 +38,7 @@ static int show_config(const char* key_, const char* value_) if (use_key_regexp && regexec(key_regexp, key_, 0, NULL, 0)) return 0; if (regexp != NULL && - (do_not_match ^ - regexec(regexp, (value_?value_:""), 0, NULL, 0))) + (do_not_match ^ !!regexec(regexp, (value_?value_:""), 0, NULL, 0))) return 0; if (show_keys) { -- 2.11.4.GIT