From: Björn Steinbrink Date: Wed, 5 Dec 2007 15:11:24 +0000 (+0100) Subject: git config: Don't rely on regexec() returning 1 on non-match X-Git-Tag: v1.5.4-rc0~73 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9e4bbeb95f5c9d046b671070eb35b3aa6f3ec5e6;p=git.git git config: Don't rely on regexec() returning 1 on non-match 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 --- diff --git a/builtin-config.c b/builtin-config.c index 4c9ded3b1..6175dc373 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) {