summaryrefslogtreecommitdiffstats
path: root/src/nspawn/nspawn.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-11-09 18:23:36 +0100
committerLennart Poettering <lennart@poettering.net>2021-11-09 18:32:15 +0100
commitd3689b94353d5f29b9d99d80bf6d888bd4eb70cc (patch)
tree179541a14e8158783d325bdb66193e8cc2ecc753 /src/nspawn/nspawn.c
parentnspawn: add helper settings_network_configured() (diff)
downloadsystemd-d3689b94353d5f29b9d99d80bf6d888bd4eb70cc.tar.xz
systemd-d3689b94353d5f29b9d99d80bf6d888bd4eb70cc.zip
nspawn: use three boolean fields from settings file when actually set
Let's turn these three fields into tristates, so that we can distinguish whether they are not configured at all from explicitly turned off. Let#s then use this to ensure that we only copy the settings fields into our execution environment if they are actually configured. We already do this for some of the boolean settings, this adds it for the missing ones. The goal here is to ensure that an empty settings file used in --settings=override mode (i.e. the default mode used in the systemd-nspawn@.service unit) is truly a NOP.
Diffstat (limited to 'src/nspawn/nspawn.c')
-rw-r--r--src/nspawn/nspawn.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index f8f9e72421..25075d2b46 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -4284,7 +4284,8 @@ static int merge_settings(Settings *settings, const char *path) {
strv_free_and_replace(arg_parameters, settings->parameters);
}
- if ((arg_settings_mask & SETTING_EPHEMERAL) == 0)
+ if ((arg_settings_mask & SETTING_EPHEMERAL) == 0 &&
+ settings->ephemeral >= 0)
arg_ephemeral = settings->ephemeral;
if ((arg_settings_mask & SETTING_DIRECTORY) == 0 &&
@@ -4454,7 +4455,8 @@ static int merge_settings(Settings *settings, const char *path) {
if ((arg_settings_mask & SETTING_BIND_USER) == 0)
strv_free_and_replace(arg_bind_user, settings->bind_user);
- if ((arg_settings_mask & SETTING_NOTIFY_READY) == 0)
+ if ((arg_settings_mask & SETTING_NOTIFY_READY) == 0 &&
+ settings->notify_ready >= 0)
arg_notify_ready = settings->notify_ready;
if ((arg_settings_mask & SETTING_SYSCALL_FILTER) == 0) {
@@ -4577,7 +4579,8 @@ static int merge_settings(Settings *settings, const char *path) {
arg_console_mode = settings->console_mode;
}
- if ((arg_settings_mask & SETTING_SUPPRESS_SYNC) == 0)
+ if ((arg_settings_mask & SETTING_SUPPRESS_SYNC) == 0 &&
+ settings->suppress_sync >= 0)
arg_suppress_sync = settings->suppress_sync;
/* The following properties can only be set through the OCI settings logic, not from the command line, hence we