summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-11-27 10:21:23 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2024-11-27 16:14:04 +0100
commitd79ba8574b8bc82b97e30bb5e60fedaf34d43c85 (patch)
treedfa9fe5e8c7ab22111a2ff64a1d63d3aa8971673 /src
parenttests: fix access mode of root inode of throw-away container images (diff)
downloadsystemd-d79ba8574b8bc82b97e30bb5e60fedaf34d43c85.tar.xz
systemd-d79ba8574b8bc82b97e30bb5e60fedaf34d43c85.zip
nspawn: improve error message when we cannot look into a container tree due to perms
Diffstat (limited to 'src')
-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 81531ac173..500725d35f 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -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;
}
}