Skip to content

Commit 1f3b1ef

Browse files
committed
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 <[email protected]>
1 parent 72e37b6 commit 1f3b1ef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ident.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static int add_mailname_host(struct strbuf *buf)
7676
strerror(errno));
7777
return -1;
7878
}
79-
if (strbuf_getline_lf(&mailnamebuf, mailname) == EOF) {
79+
if (strbuf_getline(&mailnamebuf, mailname) == EOF) {
8080
if (ferror(mailname))
8181
warning("cannot read /etc/mailname: %s",
8282
strerror(errno));

0 commit comments

Comments
 (0)