Skip to content

Commit

Permalink
ident.c: read /etc/mailname with strbuf_getline()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Jan 15, 2016
1 parent 72e37b6 commit 1f3b1ef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ident.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 1f3b1ef

Please sign in to comment.