1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-21 22:04:01 +03:00

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

View File

@ -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);