Xinqi Bao's Git

swap.c: Refactor getstats() and its usage
[slstatus.git] / components / hostname.c
index d7c10c8..dc3bbf1 100644 (file)
@@ -9,8 +9,8 @@
 const char *
 hostname(void)
 {
-       if (gethostname(buf, sizeof(buf)) == -1) {
-               fprintf(stderr, "gethostbyname: %s\n", strerror(errno));
+       if (gethostname(buf, sizeof(buf)) < 0) {
+               warn("gethostbyname:");
                return NULL;
        }