From: Nguyễn Thái Ngọc Duy Date: Sun, 8 May 2016 09:47:49 +0000 (+0700) Subject: ident.c: use warning_errno() X-Git-Tag: v2.9.0-rc0~30^2~12 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/a26f4ed682a64dcc6092c28dadb3f5c139d50576 ident.c: use warning_errno() Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff --git a/ident.c b/ident.c index 6e125821f0..337a4210a5 100644 --- a/ident.c +++ b/ident.c @@ -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;