summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-10-28 13:24:41 -0700
committerJunio C Hamano <gitster@pobox.com>2016-01-14 14:30:41 -0800
commit1651164de3a991816cc79637e31e7389d1b9d48e (patch)
treed794b9f0bddd7a17fcbe24253bcbea4297ee2df3
parent1875de51bd22e89c32f97e7427f0d86d4459e199 (diff)
downloadgit-1651164de3a991816cc79637e31e7389d1b9d48e.tar.gz
ident.c: read /etc/mailname with strbuf_getline()
Just in case /etc/mailname file was edited with a DOS editor, read it with strbuf_getline() so that a stray CR is not included as the last character of the mail hostname. We _might_ want to more aggressively discard whitespace characters around the line with strbuf_trim(), but that is a bit outside the scope of this series. Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--ident.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ident.c b/ident.c
index 9c0b38758c..5f0b746c78 100644
--- a/ident.c
+++ b/ident.c
@@ -55,7 +55,7 @@ static int add_mailname_host(struct strbuf *buf)
strerror(errno));
return -1;
}
- if (strbuf_getline_lf(&mailnamebuf, mailname) == EOF) {
+ if (strbuf_getline(&mailnamebuf, mailname) == EOF) {
if (ferror(mailname))
warning("cannot read /etc/mailname: %s",
strerror(errno));