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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
| Andrew Morton | 2.6.22-rc6-mm1 |
| Avi Kivity | [PATCH 002/104] KVM: SMP: Add vcpu_id field in struct vcpu |
| Pavel Machek | Re: suspend2 merge (was Re: [Suspend2-devel] Re: CFS and suspend2: hang in atomic ... |
| Con Kolivas | Re: -mm merge plans for 2.6.23 |
git: | |
| Junio C Hamano | What's cooking in git.git (topics) |
| Pazu | qgit on Mac OS X |
| Junio C Hamano | Re: [PATCH] Deprecate git-lost-found |
| Steffen Prohaska | Re: CVS -> SVN -> Git |
| Richard Stallman | Real men don't attack straw men |
| Siju George | Dell Latitude D820 |
| Lars Noodén | Call for testing - uvideo(4) |
| peter | ntpd not synching |
| Stephen Pierce | SLS |
| Dave `geek' Gymer | WARNING (was Re: New afio release) |
| Theodore Ts'o | Re: Splitting comp.os.linux |
| Goetz Schuchart | Re: [?] df: cannot read table of mounted filesystems |
| magical mounts | 9 hours ago | Linux kernel |
| Problem in scim in Fedora 9 | 10 hours ago | Linux general |
| The new Western Digital power saving drives | 10 hours ago | Hardware |
| Battery Maximizer Software | 1 day ago | Linux kernel |
| windows folder creation surprise | 1 day ago | Windows |
| Firewall | 1 day ago | OpenBSD |
| IP layer send packet | 2 days ago | Linux kernel |
| dtrace for linux available | 2 days ago | Linux kernel |
| Unable to mount ramdisk image using UBoot while upgrading to 2.6.15 kernel for a MPC8540 based target | 3 days ago | Linux kernel |
| RealTek RTL8169 - can't connect | 3 days ago | NetBSD |
