X-Git-Url: https://git.xinqibao.xyz/slstatus.git/blobdiff_plain/96f3a8a54eeb3b2294ed953dad8b15349f3e2703..dd7f1896aa9883f33b4d28cd192e8088db0cab5a:/components/hostname.c diff --git a/components/hostname.c b/components/hostname.c index 45dbb5b..23da677 100644 --- a/components/hostname.c +++ b/components/hostname.c @@ -7,8 +7,8 @@ const char * hostname(void) { - if (gethostname(buf, sizeof(buf)) == -1) { - fprintf(stderr, "gethostbyname failed"); + if (gethostname(buf, sizeof(buf)) < 0) { + warn("gethostbyname:"); return NULL; }