projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Git 1.8.1.3
[git.git]
/
ident.c
diff --git
a/ident.c
b/ident.c
index ac9672f607909111167559e3aa58e1585f05d0d8..1c123e685fbfbfcd5289958adc54a6cd48351628 100644
(file)
--- a/
ident.c
+++ b/
ident.c
@@
-46,6
+46,7
@@
static void copy_gecos(const struct passwd *w, struct strbuf *name)
static int add_mailname_host(struct strbuf *buf)
{
FILE *mailname;
static int add_mailname_host(struct strbuf *buf)
{
FILE *mailname;
+ struct strbuf mailnamebuf = STRBUF_INIT;
mailname = fopen("/etc/mailname", "r");
if (!mailname) {
mailname = fopen("/etc/mailname", "r");
if (!mailname) {
@@
-54,14
+55,17
@@
static int add_mailname_host(struct strbuf *buf)
strerror(errno));
return -1;
}
strerror(errno));
return -1;
}
- if (strbuf_getline(buf, mailname, '\n') == EOF) {
+ if (strbuf_getline(
&mailname
buf, mailname, '\n') == EOF) {
if (ferror(mailname))
warning("cannot read /etc/mailname: %s",
strerror(errno));
if (ferror(mailname))
warning("cannot read /etc/mailname: %s",
strerror(errno));
+ strbuf_release(&mailnamebuf);
fclose(mailname);
return -1;
}
/* success! */
fclose(mailname);
return -1;
}
/* success! */
+ strbuf_addbuf(buf, &mailnamebuf);
+ strbuf_release(&mailnamebuf);
fclose(mailname);
return 0;
}
fclose(mailname);
return 0;
}