Merge pull request #128 from liuming50/dont-hard-code-etc-hostname

Dont hard code etc hostname
This commit is contained in:
Joachim Nilsson authored and GitHub committed 2020-06-09 11:30:37 +02:00
commit 76c2054fa6
2 files changed
+7 -1

No files matched your search

+2
View File
@@ -32,7 +32,9 @@
#include "service.h" #include "service.h"
#include "conf.h" #include "conf.h"
#ifndef MODULES_LOAD_PATH
#define MODULES_LOAD_PATH "/etc/modules-load.d" #define MODULES_LOAD_PATH "/etc/modules-load.d"
#endif
#define SERVICE_LINE \ #define SERVICE_LINE \
":%d name:modprobe.%s [2345] /sbin/modprobe %s %s -- Kernel module: %s" ":%d name:modprobe.%s [2345] /sbin/modprobe %s %s -- Kernel module: %s"
+5 -1
View File
@@ -41,6 +41,10 @@
static int progress_style = PROGRESS_STYLE; 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 * Note: the pending status (⋯) must be last item. Also, ⋯ is not
* off-by-one, it's a multi-byte character. * off-by-one, it's a multi-byte character.
@@ -287,7 +291,7 @@ void set_hostname(char **hostname)
if (rescue) if (rescue)
goto done; goto done;
fp = fopen("/etc/hostname", "r"); fp = fopen(HOSTNAME_PATH, "r");
if (fp) { if (fp) {
struct stat st; struct stat st;