X-Git-Url: https://git.xinqibao.xyz/slstatus.git/blobdiff_plain/7246dc4381c6c95454672a5c1aff65a02d6d3747..b759662983a159da8a3c361f4f222287b2e43331:/components/hostname.c?ds=inline

diff --git a/components/hostname.c b/components/hostname.c
index aed77a6..d41465f 100644
--- a/components/hostname.c
+++ b/components/hostname.c
@@ -1,5 +1,7 @@
 /* See LICENSE file for copyright and license details. */
-#include <err.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
 #include <unistd.h>
 
 #include "../util.h"
@@ -7,8 +9,8 @@
 const char *
 hostname(void)
 {
-	if (gethostname(buf, sizeof(buf)) == -1) {
-		warn("hostname");
+	if (gethostname(buf, sizeof(buf)) < 0) {
+		fprintf(stderr, "gethostbyname: %s\n", strerror(errno));
 		return NULL;
 	}