summaryrefslogtreecommitdiffstats
path: root/src/nspawn/nspawn-settings.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-09-01 23:26:50 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-09-02 08:57:44 +0200
commit58cf204730ee70c51a2f4935bea915a8892634f5 (patch)
tree0f7de6d2b8f0af409fc0b84439aae476d5ab1ed6 /src/nspawn/nspawn-settings.c
parentMerge pull request #16882 from weblate/weblate-systemd-master (diff)
downloadsystemd-58cf204730ee70c51a2f4935bea915a8892634f5.tar.xz
systemd-58cf204730ee70c51a2f4935bea915a8892634f5.zip
nspawn: let's make LinkJournal an extended boolean
Let's accept the usual boolean parameters for LinkJournal. It's confusing otherwise. Previously we'd accept "no" but not the other values we typically accept for "false". We'd not accept any values for "true". With this change we'll accept all true and false values and will do something somewhat reasonable: any false value is treated like "no" previously was reated. And any true value is now treated like "auto". We don't document the new values, since this logic is mostly redundant, and it's probably better if people consider this an enum rather than a bool. Fixes: #16888
Diffstat (limited to 'src/nspawn/nspawn-settings.c')
-rw-r--r--src/nspawn/nspawn-settings.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/nspawn/nspawn-settings.c b/src/nspawn/nspawn-settings.c
index d341fa25aa..2fa5cc40a3 100644
--- a/src/nspawn/nspawn-settings.c
+++ b/src/nspawn/nspawn-settings.c
@@ -809,6 +809,8 @@ static const char *const resolv_conf_mode_table[_RESOLV_CONF_MODE_MAX] = {
DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(resolv_conf_mode, ResolvConfMode, RESOLV_CONF_AUTO);
int parse_link_journal(const char *s, LinkJournal *ret_mode, bool *ret_try) {
+ int r;
+
assert(s);
assert(ret_mode);
assert(ret_try);
@@ -816,9 +818,6 @@ int parse_link_journal(const char *s, LinkJournal *ret_mode, bool *ret_try) {
if (streq(s, "auto")) {
*ret_mode = LINK_AUTO;
*ret_try = false;
- } else if (streq(s, "no")) {
- *ret_mode = LINK_NO;
- *ret_try = false;
} else if (streq(s, "guest")) {
*ret_mode = LINK_GUEST;
*ret_try = false;
@@ -831,8 +830,16 @@ int parse_link_journal(const char *s, LinkJournal *ret_mode, bool *ret_try) {
} else if (streq(s, "try-host")) {
*ret_mode = LINK_HOST;
*ret_try = true;
- } else
- return -EINVAL;
+ } else {
+ /* Also support boolean values, to make things less confusing. */
+ r = parse_boolean(s);
+ if (r < 0)
+ return r;
+
+ /* Let's consider "true" to be equivalent to "auto". */
+ *ret_mode = r ? LINK_AUTO : LINK_NO;
+ *ret_try = false;
+ }
return 0;
}