Skip to content

Commit a26f4ed

Browse files
pcloudsgitster
authored andcommitted
ident.c: use warning_errno()
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d2e255e commit a26f4ed

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

ident.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,12 @@ static int add_mailname_host(struct strbuf *buf)
7575
mailname = fopen("/etc/mailname", "r");
7676
if (!mailname) {
7777
if (errno != ENOENT)
78-
warning("cannot open /etc/mailname: %s",
79-
strerror(errno));
78+
warning_errno("cannot open /etc/mailname");
8079
return -1;
8180
}
8281
if (strbuf_getline(&mailnamebuf, mailname) == EOF) {
8382
if (ferror(mailname))
84-
warning("cannot read /etc/mailname: %s",
85-
strerror(errno));
83+
warning_errno("cannot read /etc/mailname");
8684
strbuf_release(&mailnamebuf);
8785
fclose(mailname);
8886
return -1;
@@ -125,7 +123,7 @@ static void add_domainname(struct strbuf *out, int *is_bogus)
125123
char buf[1024];
126124

127125
if (gethostname(buf, sizeof(buf))) {
128-
warning("cannot get host name: %s", strerror(errno));
126+
warning_errno("cannot get host name");
129127
strbuf_addstr(out, "(none)");
130128
*is_bogus = 1;
131129
return;

0 commit comments

Comments
 (0)