提交 a26f4ed6 编写于 作者: N Nguyễn Thái Ngọc Duy 提交者: Junio C Hamano

ident.c: use warning_errno()

Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 d2e255ee
......@@ -75,14 +75,12 @@ static int add_mailname_host(struct strbuf *buf)
mailname = fopen("/etc/mailname", "r");
if (!mailname) {
if (errno != ENOENT)
warning("cannot open /etc/mailname: %s",
strerror(errno));
warning_errno("cannot open /etc/mailname");
return -1;
}
if (strbuf_getline(&mailnamebuf, mailname) == EOF) {
if (ferror(mailname))
warning("cannot read /etc/mailname: %s",
strerror(errno));
warning_errno("cannot read /etc/mailname");
strbuf_release(&mailnamebuf);
fclose(mailname);
return -1;
......@@ -125,7 +123,7 @@ static void add_domainname(struct strbuf *out, int *is_bogus)
char buf[1024];
if (gethostname(buf, sizeof(buf))) {
warning("cannot get host name: %s", strerror(errno));
warning_errno("cannot get host name");
strbuf_addstr(out, "(none)");
*is_bogus = 1;
return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册