X-Git-Url: https://git.xinqibao.xyz/slstatus.git/blobdiff_plain/7246dc4381c6c95454672a5c1aff65a02d6d3747..6c6c144be62d6b2da564f0875ba5f202dbaa3183:/components/hostname.c 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 +#include +#include +#include #include #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; }