From bc149d95fcf33f79c81df4043913f9bf240c9a09 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Sat, 30 Dec 2017 20:05:07 +0100 Subject: [PATCH] conf: Add `hostname` alias to `host` Signed-off-by: Joachim Nilsson --- doc/config.md | 4 ++++ src/conf.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/config.md b/doc/config.md index 95fc3d25..fb172b0e 100644 --- a/doc/config.md +++ b/doc/config.md @@ -84,6 +84,10 @@ restart/reload.* Syntax ------ +* `host `, or `hostname ` + Set system hostname to NAME, unless `/etc/hostname` exists in which + case the contents of that file is used. + * `module [ARGS]` Load a kernel module, with optional arguments diff --git a/src/conf.c b/src/conf.c index 4188c465..94b5d1a5 100644 --- a/src/conf.c +++ b/src/conf.c @@ -333,7 +333,7 @@ static void parse_static(char *line) char *x; char cmd[CMD_SIZE]; - if (BOOTSTRAP && MATCH_CMD(line, "host ", x)) { + if (BOOTSTRAP && (MATCH_CMD(line, "host ", x) || MATCH_CMD(line, "hostname ", x))) { if (hostname) free(hostname); hostname = strdup(strip_line(x)); return;