Skip to content

Commit 9e4bbeb

Browse files
dotdashgitster
authored andcommitted
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 <B.Steinbrink@gmx.de> Tested-by: H.Merijn Brand <h.m.brand@xs4all.nl> Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 2164037 commit 9e4bbeb

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

builtin-config.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ static int show_config(const char* key_, const char* value_)
3838
if (use_key_regexp && regexec(key_regexp, key_, 0, NULL, 0))
3939
return 0;
4040
if (regexp != NULL &&
41-
(do_not_match ^
42-
regexec(regexp, (value_?value_:""), 0, NULL, 0)))
41+
(do_not_match ^ !!regexec(regexp, (value_?value_:""), 0, NULL, 0)))
4342
return 0;
4443

4544
if (show_keys) {

0 commit comments

Comments
 (0)