From ad9e7bc1ae797e9ca4cc02916ddc0a2dbba85173 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 16 Feb 2017 12:02:17 +0100 Subject: [PATCH] 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. --- src/basic/hostname-util.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); } -- 2.30.2