1 |
commit: c831f1f994e187afd8edfff15e4063b99440bbcb |
2 |
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com> |
3 |
AuthorDate: Thu Nov 5 17:08:29 2015 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Nov 5 17:20:57 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=c831f1f9 |
7 |
|
8 |
librc: rework overriding rc.conf options from the kcl |
9 |
|
10 |
Rename the rc_conf_override function to describe its purpose better, |
11 |
drop one conditional compile by making it available everywhere, and move |
12 |
the call to it after the optional rc.conf.d directory is processed. |
13 |
|
14 |
src/librc/librc-misc.c | 19 ++++++++----------- |
15 |
1 file changed, 8 insertions(+), 11 deletions(-) |
16 |
|
17 |
diff --git a/src/librc/librc-misc.c b/src/librc/librc-misc.c |
18 |
index 2c73663..98e6f20 100644 |
19 |
--- a/src/librc/librc-misc.c |
20 |
+++ b/src/librc/librc-misc.c |
21 |
@@ -280,11 +280,14 @@ static void rc_config_set_value(RC_STRINGLIST *config, char *value) |
22 |
} |
23 |
|
24 |
/* |
25 |
- * Override some specific rc.conf options on the kernel command line |
26 |
+ * Override some specific rc.conf options on the kernel command line. |
27 |
+ * I only know how to do this in Linux, so if someone wants to supply |
28 |
+ * a patch for this on *BSD or tell me how to write the code to do this, |
29 |
+ * any suggestions are welcome. |
30 |
*/ |
31 |
-#ifdef __linux__ |
32 |
-static RC_STRINGLIST *rc_config_override(RC_STRINGLIST *config) |
33 |
+static RC_STRINGLIST *rc_config_kcl(RC_STRINGLIST *config) |
34 |
{ |
35 |
+#ifdef __linux__ |
36 |
RC_STRINGLIST *overrides; |
37 |
RC_STRING *cline, *override, *config_np; |
38 |
char *tmp = NULL; |
39 |
@@ -333,9 +336,9 @@ static RC_STRINGLIST *rc_config_override(RC_STRINGLIST *config) |
40 |
} |
41 |
|
42 |
rc_stringlist_free(overrides); |
43 |
+#endif |
44 |
return config; |
45 |
} |
46 |
-#endif |
47 |
|
48 |
static RC_STRINGLIST * rc_config_directory(RC_STRINGLIST *config) |
49 |
{ |
50 |
@@ -387,13 +390,6 @@ rc_config_load(const char *file) |
51 |
} |
52 |
rc_stringlist_free(list); |
53 |
|
54 |
-#ifdef __linux__ |
55 |
- /* Only override rc.conf settings */ |
56 |
- if (strcmp(file, RC_CONF) == 0) { |
57 |
- config = rc_config_override(config); |
58 |
- } |
59 |
-#endif |
60 |
- |
61 |
return config; |
62 |
} |
63 |
librc_hidden_def(rc_config_load) |
64 |
@@ -444,6 +440,7 @@ rc_conf_value(const char *setting) |
65 |
} |
66 |
|
67 |
rc_conf = rc_config_directory(rc_conf); |
68 |
+ rc_conf = rc_config_kcl(rc_conf); |
69 |
|
70 |
/* Convert old uppercase to lowercase */ |
71 |
TAILQ_FOREACH(s, rc_conf, entries) { |