X-Git-Url: https://git.xinqibao.xyz/slstatus.git/blobdiff_plain/faa52bdcc0221de2d8fae950e409a8ac5e05bfcd..7873b3b1329d31e619a93cce99350a36803656d1:/components/hostname.c?ds=inline

diff --git a/components/hostname.c b/components/hostname.c
index d7c10c8..dc3bbf1 100644
--- a/components/hostname.c
+++ b/components/hostname.c
@@ -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;
 	}