summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/service.c2
-rw-r--r--src/nspawn/nspawn.c11
-rwxr-xr-xtest/units/util.sh1
3 files changed, 9 insertions, 5 deletions
diff --git a/src/core/service.c b/src/core/service.c
index 34d40c6950..f4919bb2b1 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -1879,7 +1879,7 @@ static int service_spawn_internal(
}
}
- if (s->restart_mode == SERVICE_RESTART_MODE_DEBUG && UNIT(s)->debug_invocation) {
+ if (UNIT(s)->debug_invocation) {
char *t = strdup("DEBUG_INVOCATION=1");
if (!t)
return -ENOMEM;
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 91700d9282..500725d35f 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -5772,7 +5772,7 @@ static int run_container(
r = wait_for_container(TAKE_PID(*pid), &container_status);
/* Tell machined that we are gone. */
- if (bus)
+ if (arg_register && bus)
(void) unregister_machine(bus, arg_machine);
if (r < 0)
@@ -6200,9 +6200,12 @@ static int run(int argc, char *argv[]) {
goto finish;
}
- if (access_nofollow(p, F_OK) < 0) {
- r = log_error_errno(SYNTHETIC_ERRNO(EINVAL),
- "Directory %s doesn't look like it has an OS tree (/usr/ directory is missing). Refusing.", arg_directory);
+ r = access_nofollow(p, F_OK);
+ if (r == -ENOENT) {
+ log_error_errno(r, "Directory %s doesn't look like it has an OS tree (/usr/ directory is missing). Refusing.", arg_directory);
+ goto finish;
+ } else if (r < 0) {
+ log_error_errno(r, "Unable to determine if %s looks like it has an OS tree (i.e. whether /usr/ exists): %m", arg_directory);
goto finish;
}
}
diff --git a/test/units/util.sh b/test/units/util.sh
index 51e0ad1ec0..7a39d4267e 100755
--- a/test/units/util.sh
+++ b/test/units/util.sh
@@ -182,6 +182,7 @@ create_dummy_container() {
fi
mkdir -p "$root"
+ chmod 555 "$root"
cp -a /usr/share/TEST-13-NSPAWN-container-template/* "$root"
coverage_create_nspawn_dropin "$root"
}