aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2015-11-05 11:08:29 -0600
committerWilliam Hubbs <w.d.hubbs@gmail.com>2015-11-05 11:20:57 -0600
commitc831f1f994e187afd8edfff15e4063b99440bbcb (patch)
tree56b153a7ec14d4e51062337cb9ee5f4daa05ac18
parent591aea28215a8b5ad8660184dc6f6f15ff0c18b4 (diff)
librc: rework overriding rc.conf options from the kcl
Rename the rc_conf_override function to describe its purpose better, drop one conditional compile by making it available everywhere, and move the call to it after the optional rc.conf.d directory is processed.
-rw-r--r--src/librc/librc-misc.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/librc/librc-misc.c b/src/librc/librc-misc.c
index 2c736635..98e6f200 100644
--- a/src/librc/librc-misc.c
+++ b/src/librc/librc-misc.c
@@ -280,11 +280,14 @@ static void rc_config_set_value(RC_STRINGLIST *config, char *value)
}
/*
- * Override some specific rc.conf options on the kernel command line
+ * Override some specific rc.conf options on the kernel command line.
+ * I only know how to do this in Linux, so if someone wants to supply
+ * a patch for this on *BSD or tell me how to write the code to do this,
+ * any suggestions are welcome.
*/
-#ifdef __linux__
-static RC_STRINGLIST *rc_config_override(RC_STRINGLIST *config)
+static RC_STRINGLIST *rc_config_kcl(RC_STRINGLIST *config)
{
+#ifdef __linux__
RC_STRINGLIST *overrides;
RC_STRING *cline, *override, *config_np;
char *tmp = NULL;
@@ -333,9 +336,9 @@ static RC_STRINGLIST *rc_config_override(RC_STRINGLIST *config)
}
rc_stringlist_free(overrides);
+#endif
return config;
}
-#endif
static RC_STRINGLIST * rc_config_directory(RC_STRINGLIST *config)
{
@@ -387,13 +390,6 @@ rc_config_load(const char *file)
}
rc_stringlist_free(list);
-#ifdef __linux__
- /* Only override rc.conf settings */
- if (strcmp(file, RC_CONF) == 0) {
- config = rc_config_override(config);
- }
-#endif
-
return config;
}
librc_hidden_def(rc_config_load)
@@ -444,6 +440,7 @@ rc_conf_value(const char *setting)
}
rc_conf = rc_config_directory(rc_conf);
+ rc_conf = rc_config_kcl(rc_conf);
/* Convert old uppercase to lowercase */
TAILQ_FOREACH(s, rc_conf, entries) {