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.
This commit is contained in:
Lennart Poettering 2017-02-16 12:02:17 +01:00
parent f73e6ee687
commit d91e8e1b69

View file

@ -55,7 +55,7 @@ char* gethostname_malloc(void) {
assert_se(uname(&u) >= 0);
if (isempty(u.nodename) || streq(u.nodename, "(none)"))
return strdup(u.sysname);
return strdup(FALLBACK_HOSTNAME);
return strdup(u.nodename);
}