X-Git-Url: https://git.xinqibao.xyz/slstatus.git/blobdiff_plain/16a97fbca129bca5656f76191c1b324b1649ec22..0383146e5e616e81c13b23a127ecfa697feac7db:/components/ip.c?ds=inline diff --git a/components/ip.c b/components/ip.c index 85ac15e..fce2b66 100644 --- a/components/ip.c +++ b/components/ip.c @@ -19,7 +19,7 @@ ipv4(const char *iface) char host[NI_MAXHOST]; if (getifaddrs(&ifaddr) < 0) { - fprintf(stderr, "getifaddrs: %s\n", strerror(errno)); + warn("getifaddrs:"); return NULL; } @@ -32,7 +32,7 @@ ipv4(const char *iface) if (!strcmp(ifa->ifa_name, iface) && (ifa->ifa_addr->sa_family == AF_INET)) { if (s != 0) { - fprintf(stderr, "getnameinfo: %s\n", gai_strerror(s)); + warn("getnameinfo: %s", gai_strerror(s)); return NULL; } return bprintf("%s", host); @@ -52,7 +52,7 @@ ipv6(const char *iface) char host[NI_MAXHOST]; if (getifaddrs(&ifaddr) < 0) { - fprintf(stderr, "getifaddrs: %s\n", strerror(errno)); + warn("getifaddrs:"); return NULL; } @@ -65,7 +65,7 @@ ipv6(const char *iface) if (!strcmp(ifa->ifa_name, iface) && (ifa->ifa_addr->sa_family == AF_INET6)) { if (s != 0) { - fprintf(stderr, "getnameinfo: %s\n", gai_strerror(s)); + warn("getnameinfo: %s", gai_strerror(s)); return NULL; } return bprintf("%s", host);