From: Lennart Poettering Date: Thu, 16 Feb 2017 11:03:39 +0000 (+0100) Subject: core: when booting up, initialize hostname to compile-time fallback hostname X-Git-Tag: v233~81^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8341d4fa04e77afce1a68e920a6a684624ddb2b6;p=thirdparty%2Fsystemd.git core: when booting up, initialize hostname to compile-time fallback hostname When /etc/hostname isn't set, default to the configured compile-time fallback hostname instead of "localhost" for the kernel hostname. --- diff --git a/src/core/hostname-setup.c b/src/core/hostname-setup.c index 68be52856b3..845e31e1c59 100644 --- a/src/core/hostname-setup.c +++ b/src/core/hostname-setup.c @@ -31,10 +31,10 @@ #include "util.h" int hostname_setup(void) { - int r; _cleanup_free_ char *b = NULL; - const char *hn; bool enoent = false; + const char *hn; + int r; r = read_hostname_config("/etc/hostname", &b); if (r < 0) { @@ -56,7 +56,7 @@ int hostname_setup(void) { if (enoent) log_info("No hostname configured."); - hn = "localhost"; + hn = FALLBACK_HOSTNAME; } r = sethostname_idempotent(hn);