From a7adff4c4b347f26a5957a761b16845f2165a376 Mon Sep 17 00:00:00 2001 From: Ming Liu Date: Tue, 9 Jun 2020 10:51:19 +0200 Subject: [PATCH 1/2] helpers.c: dont hard code /etc/hostname Introduce a macro HOSTNAME_PATH instead. Signed-off-by: Ming Liu --- src/helpers.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/helpers.c b/src/helpers.c index 3e3b42e4..5ea4d9a3 100644 --- a/src/helpers.c +++ b/src/helpers.c @@ -41,6 +41,10 @@ static int progress_style = PROGRESS_STYLE; +#ifndef HOSTNAME_PATH +#define HOSTNAME_PATH "/etc/hostname" +#endif + /* * Note: the pending status (⋯) must be last item. Also, ⋯ is not * off-by-one, it's a multi-byte character. @@ -287,7 +291,7 @@ void set_hostname(char **hostname) if (rescue) goto done; - fp = fopen("/etc/hostname", "r"); + fp = fopen(HOSTNAME_PATH, "r"); if (fp) { struct stat st; From 1fa6a98e79db52e4ddcfc1db8a7f8eea5e96b7f0 Mon Sep 17 00:00:00 2001 From: Ming Liu Date: Tue, 9 Jun 2020 10:54:09 +0200 Subject: [PATCH 2/2] modules-load.c: allow MODULES_LOAD_PATH to be overridden Define MODULES_LOAD_PATH only when it's unset, this allows it to be overridden, for instance, by passing CFLAGS. Signed-off-by: Ming Liu --- plugins/modules-load.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/modules-load.c b/plugins/modules-load.c index 1fcf5e65..a8bc7d04 100644 --- a/plugins/modules-load.c +++ b/plugins/modules-load.c @@ -32,7 +32,9 @@ #include "service.h" #include "conf.h" +#ifndef MODULES_LOAD_PATH #define MODULES_LOAD_PATH "/etc/modules-load.d" +#endif #define SERVICE_LINE \ ":%d name:modprobe.%s [2345] /sbin/modprobe %s %s -- Kernel module: %s"