From: Lennart Poettering Date: Thu, 16 Feb 2017 11:02:17 +0000 (+0100) Subject: hostname-util: default to the compile time default hostname in gethostname_malloc() X-Git-Tag: v233.3~58 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=ad9e7bc1ae797e9ca4cc02916ddc0a2dbba85173;ds=sidebyside hostname-util: default to the compile time default hostname in gethostname_malloc() Currently, if the hostname is not set gethostname_malloc() defaults to the "sysname", which is "linux" on Linux. Let's change that to also honour the compile-time fallback hostname as specified on the configure command line. --- diff --git a/src/basic/hostname-util.c b/src/basic/hostname-util.c index 5aebd89e3..63329d53b 100644 --- a/src/basic/hostname-util.c +++ b/src/basic/hostname-util.c @@ -57,7 +57,11 @@ char* gethostname_malloc(void) { assert_se(uname(&u) >= 0); if (isempty(u.nodename) || streq(u.nodename, "(none)")) - return strdup(u.sysname); +#if 0 /// elogind has no hostnamed and such nonsense + return strdup(FALLBACK_HOSTNAME); +#else + return strdup("localhost"); +#endif // 0 return strdup(u.nodename); }