git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: "Tom G. Christensen" <tgc@jupiterrise.com>
Cc: Patrick Steinhardt <ps@pks.im>,
	Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org
Subject: [PATCH 2/3] git_config_set_multivar_in_file: all non-zero returns are errors
Date: Sat, 9 Apr 2016 13:42:54 -0400	[thread overview]
Message-ID: <20160409174253.GB11873@sigill.intra.peff.net> (raw)
In-Reply-To: <20160409173904.GA5127@sigill.intra.peff.net>

This function is just a thin wrapper for the "_gently" form
of the function. But the gently form is designed to feed
builtin/config.c, which passes our return code directly to
its exit status, and thus uses positive error values for
some cases. We check only negative values, meaning we would
fail to die in some cases (e.g., a malformed key).

This may or may not be triggerable in practice; we tend to
use this non-gentle form only when setting internal
variables, which would not have malformed keys.

Signed-off-by: Jeff King <peff@peff.net>
---
 config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.c b/config.c
index 6b81931..d446315 100644
--- a/config.c
+++ b/config.c
@@ -2222,7 +2222,7 @@ void git_config_set_multivar_in_file(const char *config_filename,
 				     const char *value_regex, int multi_replace)
 {
 	if (git_config_set_multivar_in_file_gently(config_filename, key, value,
-						   value_regex, multi_replace) < 0)
+						   value_regex, multi_replace))
 		die(_("could not set '%s' to '%s'"), key, value);
 }
 
-- 
2.8.1.245.g18e0f5c

  parent reply	other threads:[~2016-04-09 17:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-07 18:18 git segfaults on older Solaris releases Tom G. Christensen
2016-04-07 18:32 ` Junio C Hamano
2016-04-07 18:50   ` Junio C Hamano
2016-04-07 18:56     ` David Turner
2016-04-07 19:07     ` Jeff King
2016-04-07 19:37       ` Junio C Hamano
2016-04-07 20:24         ` Jeff King
2016-04-07 20:19     ` Tom G. Christensen
2016-04-09  7:02       ` Tom G. Christensen
2016-04-09 17:39         ` Jeff King
2016-04-09 17:42           ` [PATCH 1/3] config: lower-case first word of error strings Jeff King
2016-04-09 17:42           ` Jeff King [this message]
2016-04-09 17:43           ` [PATCH 3/3] git_config_set_multivar_in_file: handle "unset" errors Jeff King
2016-04-09 20:17           ` git segfaults on older Solaris releases Tom G. Christensen
2016-04-09 20:35             ` Jeff King
2016-04-12 10:21           ` Patrick Steinhardt
2016-04-07 18:58   ` Tom G. Christensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160409174253.GB11873@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=ps@pks.im \
    --cc=tgc@jupiterrise.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).