From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Whit Armstrong <armstrong.whit@gmail.com>, git@vger.kernel.org
Subject: [PATCH 1/3] git_config_*: don't assume we are parsing a config file
Date: Wed, 20 Feb 2008 19:00:32 -0500 [thread overview]
Message-ID: <20080221000032.GA6429@coredump.intra.peff.net> (raw)
In-Reply-To: <20080220235944.GA6278@coredump.intra.peff.net>
These functions get called by other code, including parsing
config options from the command line. In that case,
config_file_name is NULL, leading to an ugly message or even
a segfault on some implementations of printf.
Signed-off-by: Jeff King <peff@peff.net>
---
config.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/config.c b/config.c
index 8064cae..cba2bcf 100644
--- a/config.c
+++ b/config.c
@@ -280,11 +280,18 @@ int git_parse_ulong(const char *value, unsigned long *ret)
return 0;
}
+static void die_bad_config(const char *name)
+{
+ if (config_file_name)
+ die("bad config value for '%s' in %s", name, config_file_name);
+ die("bad config value for '%s'", name);
+}
+
int git_config_int(const char *name, const char *value)
{
long ret;
if (!git_parse_long(value, &ret))
- die("bad config value for '%s' in %s", name, config_file_name);
+ die_bad_config(name);
return ret;
}
@@ -292,7 +299,7 @@ unsigned long git_config_ulong(const char *name, const char *value)
{
unsigned long ret;
if (!git_parse_ulong(value, &ret))
- die("bad config value for '%s' in %s", name, config_file_name);
+ die_bad_config(name);
return ret;
}
--
1.5.4.2.247.g107bd
next prev parent reply other threads:[~2008-02-21 0:01 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-20 23:59 [PATCH 0/3] solaris test results Jeff King
2008-02-21 0:00 ` Jeff King [this message]
2008-02-21 0:00 ` [PATCH 2/3] t3404: use configured shell instead of /bin/sh Jeff King
2008-02-23 20:13 ` Johannes Sixt
2008-02-23 20:26 ` Junio C Hamano
2008-02-23 20:34 ` Junio C Hamano
2008-02-23 21:09 ` Johannes Sixt
2008-02-23 21:15 ` Jeff King
2008-02-23 21:56 ` Junio C Hamano
2008-02-23 22:39 ` Jeff King
2008-02-23 22:46 ` Junio C Hamano
2008-02-23 22:49 ` Jeff King
2008-02-23 22:55 ` Junio C Hamano
2008-02-23 23:12 ` Jeff King
2008-02-24 0:03 ` Junio C Hamano
2008-02-24 19:40 ` Jeff King
2008-02-23 20:40 ` Jeff King
2008-02-23 20:50 ` Junio C Hamano
2008-02-23 21:12 ` Jeff King
2008-02-23 22:28 ` Jeff King
2008-02-23 22:35 ` Junio C Hamano
2008-02-23 22:44 ` Jeff King
2008-02-21 0:01 ` [PATCH 3/3] diff: fix java funcname pattern for solaris Jeff King
2008-02-21 0:34 ` [PATCH 0/3] solaris test results Junio C Hamano
2008-02-21 0:41 ` Jeff King
2008-02-22 5:26 ` Junio C Hamano
2008-02-22 5:29 ` Junio C Hamano
2008-02-22 5:42 ` Jeff King
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080221000032.GA6429@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=armstrong.whit@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.