wrapper.c: add and use fopen_or_warn()
[gitweb.git] / ident.c
diff --git a/ident.c b/ident.c
index bea871c8e02b7173eeba5527d22f5ae7783c011e..91c7609055bf3e0a4c0b7ae3cb46219ccaad53ef 100644 (file)
--- a/ident.c
+++ b/ident.c
@@ -72,12 +72,10 @@ static int add_mailname_host(struct strbuf *buf)
        FILE *mailname;
        struct strbuf mailnamebuf = STRBUF_INIT;
 
-       mailname = fopen("/etc/mailname", "r");
-       if (!mailname) {
-               if (errno != ENOENT)
-                       warning_errno("cannot open /etc/mailname");
+       mailname = fopen_or_warn("/etc/mailname", "r");
+       if (!mailname)
                return -1;
-       }
+
        if (strbuf_getline(&mailnamebuf, mailname) == EOF) {
                if (ferror(mailname))
                        warning_errno("cannot read /etc/mailname");