summaryrefslogtreecommitdiff
path: root/builtin-config.c
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2007-12-05 15:11:24 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-12-05 19:34:44 (GMT)
commit9e4bbeb95f5c9d046b671070eb35b3aa6f3ec5e6 (patch)
tree5a7d16992359ae791413185cd75dc7ab4b326c40 /builtin-config.c
parent21640376a5b3e55557020a4932ba78daffc2d77e (diff)
downloadgit-9e4bbeb95f5c9d046b671070eb35b3aa6f3ec5e6.zip
git-9e4bbeb95f5c9d046b671070eb35b3aa6f3ec5e6.tar.gz
git-9e4bbeb95f5c9d046b671070eb35b3aa6f3ec5e6.tar.bz2
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>
Diffstat (limited to 'builtin-config.c')
-rw-r--r--builtin-config.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/builtin-config.c b/builtin-config.c
index 4c9ded3..6175dc3 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) {