mirror of
https://github.com/git/git.git
synced 2024-09-28 16:13:01 +02:00
ident: trim trailing newline from /etc/mailname
We use fgets to read the /etc/mailname file, which means we will typically end up with an extra newline in our git_default_email. Most of the time this doesn't matter, as fmt_ident will skip it as cruft, but there is one code path that accesses it directly (in http-push.c:lock_remote). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
2d4b4fcebd
commit
132f4b6ccb
4
ident.c
4
ident.c
@ -74,6 +74,10 @@ static int add_mailname_host(char *buf, size_t len)
|
||||
}
|
||||
/* success! */
|
||||
fclose(mailname);
|
||||
|
||||
len = strlen(buf);
|
||||
if (len && buf[len-1] == '\n')
|
||||
buf[len-1] = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user