summaryrefslogtreecommitdiff
path: root/src/basic/hostname-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-02-16 12:02:17 +0100
committerSven Eden <yamakuzure@gmx.net>2017-07-17 17:58:36 +0200
commitad9e7bc1ae797e9ca4cc02916ddc0a2dbba85173 (patch)
tree030673e88409ef6a8135570c2ffc457c0fceba3b /src/basic/hostname-util.c
parentc215fdfe0ea740def6e63c999e1dc9431c8b68b5 (diff)
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.
Diffstat (limited to 'src/basic/hostname-util.c')
-rw-r--r--src/basic/hostname-util.c6
1 files changed, 5 insertions, 1 deletions
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);
}