summaryrefslogtreecommitdiff
path: root/src/core/hostname-setup.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-02-16 12:03:39 +0100
committerLennart Poettering <lennart@poettering.net>2017-02-17 10:19:26 +0100
commit8341d4fa04e77afce1a68e920a6a684624ddb2b6 (patch)
tree7adafcb9a257dc4d3495777d20d88a3fe7be5f44 /src/core/hostname-setup.c
parentd91e8e1b696a58ec98099dbca517d748b382c3e9 (diff)
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.
Diffstat (limited to 'src/core/hostname-setup.c')
-rw-r--r--src/core/hostname-setup.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/hostname-setup.c b/src/core/hostname-setup.c
index 68be52856b..845e31e1c5 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);