From 12efeb634552cc993f9bacb8174b34214f777283 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Mon, 29 Mar 2021 00:03:14 +0200 Subject: blogc: sysinfo: get fqdn if available --- src/blogc/sysinfo.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/blogc/sysinfo.c b/src/blogc/sysinfo.c index cdb860e..3c30996 100644 --- a/src/blogc/sysinfo.c +++ b/src/blogc/sysinfo.c @@ -18,6 +18,10 @@ #include #endif /* HAVE_TIME_H */ +#ifdef HAVE_NETDB_H +#include +#endif + #include #include #include @@ -38,6 +42,12 @@ blogc_sysinfo_get_hostname(void) if (-1 == gethostname(buf, 1024)) return NULL; +#ifdef HAVE_NETDB_H + struct hostent *h = gethostbyname(buf); + if (h != NULL && h->h_name != NULL) + return bc_strdup(h->h_name); +#endif + // FIXME: return FQDN instead of local host name return bc_strdup(buf); #endif -- cgit v1.2.3-18-g5258