]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
hostname-util: default to the compile time default hostname in gethostname_malloc()
authorLennart Poettering <lennart@poettering.net>
Thu, 16 Feb 2017 11:02:17 +0000 (12:02 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 17 Feb 2017 09:19:26 +0000 (10:19 +0100)
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

index e44a357287c6e9dfb0ccc4f82e380fe4ae43ef2e..a94037b3035d8c53e40cf419af040868f67adc32 100644 (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);
 }