mirror of
https://github.com/troglobit/finit.git
synced 2026-11-14 19:03:16 +00:00
helpers.c: dont hard code /etc/hostname
Introduce a macro HOSTNAME_PATH instead. Signed-off-by: Ming Liu <liu.ming50@gmail.com>
This commit is contained in:
1 parent
af6f71abe4
commit
a7adff4c4b
1 file changed
+5
-1
+5
-1
@@ -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;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user