From: Junio C Hamano Date: Wed, 28 Oct 2015 20:24:41 +0000 (-0700) Subject: ident.c: read /etc/mailname with strbuf_getline() X-Git-Tag: v2.8.0-rc0~85^2~8 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=1f3b1efd18a935fed41431132c67cde5a94833ae;p=git-core%2Fgit.git 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 --- diff --git a/ident.c b/ident.c index 9dd3ae345..3da555634 100644 --- a/ident.c +++ b/ident.c @@ -76,7 +76,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));