* [PATCH] commit.c: guard config parser from value=NULL
@ 2008-02-09 20:16 Govind Salinas
2008-02-10 2:57 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Govind Salinas @ 2008-02-09 20:16 UTC (permalink / raw)
To: Git Mailing List; +Cc: Junio C Hamano
Signed-off-by: Govind Salinas <blix@sophiasuchtig.com>
---
config.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/config.c b/config.c
index 498259e..8247e88 100644
--- a/config.c
+++ b/config.c
@@ -407,12 +407,12 @@ int git_default_config(const char *var, const char *value)
return 0;
}
- if (!strcmp(var, "user.name")) {
+ if (value && !strcmp(var, "user.name")) {
strlcpy(git_default_name, value, sizeof(git_default_name));
return 0;
}
- if (!strcmp(var, "user.email")) {
+ if (value && !strcmp(var, "user.email")) {
strlcpy(git_default_email, value, sizeof(git_default_email));
return 0;
}
--
1.5.4.36.g9af61
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] commit.c: guard config parser from value=NULL
2008-02-09 20:16 [PATCH] commit.c: guard config parser from value=NULL Govind Salinas
@ 2008-02-10 2:57 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2008-02-10 2:57 UTC (permalink / raw)
To: Govind Salinas; +Cc: Git Mailing List, Junio C Hamano
"Govind Salinas" <govind@sophiasuchtig.com> writes:
> - if (!strcmp(var, "user.name")) {
> + if (value && !strcmp(var, "user.name")) {
> strlcpy(git_default_name, value, sizeof(git_default_name));
> return 0;
> }
This is wrong, isn't it? When somebody says
[user]
name
we should not silently ignore it, but instead say "user.name is
not a bool!" and error out.
The same comment applies to all other
if (value && !strcmp(var, "<varname>"))
conversions.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-02-10 2:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-09 20:16 [PATCH] commit.c: guard config parser from value=NULL Govind Salinas
2008-02-10 2:57 ` Junio C Hamano
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 NNTP newsgroup(s).