summaryrefslogtreecommitdiff
path: root/src/nspawn/nspawn-mount.c
diff options
context:
space:
mode:
authorAnita Zhang <the.anitazha@gmail.com>2019-11-19 14:24:52 -0800
committerAnita Zhang <the.anitazha@gmail.com>2019-12-18 11:09:30 -0800
commite5f10cafe0bb1034505cba934cd6fae5f332b1dc (patch)
tree73b0aeade6ba5c0a0fb527449d3cecb394f9eb5a /src/nspawn/nspawn-mount.c
parenta49ad4c482b8336f62f53da1a574e5b57e803271 (diff)
downloadsystemd-e5f10cafe0bb1034505cba934cd6fae5f332b1dc.tar.gz
core: create inaccessible nodes for users when making runtime dirs
To support ProtectHome=y in a user namespace (which mounts the inaccessible nodes), the nodes need to be accessible by the user. Create these paths and devices in the user runtime directory so they can be used later if needed.
Diffstat (limited to 'src/nspawn/nspawn-mount.c')
-rw-r--r--src/nspawn/nspawn-mount.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nspawn/nspawn-mount.c b/src/nspawn/nspawn-mount.c
index 0fb83a4ff3..f423f62590 100644
--- a/src/nspawn/nspawn-mount.c
+++ b/src/nspawn/nspawn-mount.c
@@ -883,8 +883,7 @@ static int mount_overlay(const char *dest, CustomMount *m) {
}
static int mount_inaccessible(const char *dest, CustomMount *m) {
- _cleanup_free_ char *where = NULL;
- const char *source;
+ _cleanup_free_ char *where = NULL, *source = NULL;
struct stat st;
int r;
@@ -897,7 +896,9 @@ static int mount_inaccessible(const char *dest, CustomMount *m) {
return m->graceful ? 0 : r;
}
- assert_se(source = mode_to_inaccessible_node(st.st_mode));
+ r = mode_to_inaccessible_node("/run/systemd", st.st_mode, &source);
+ if (r < 0)
+ return m->graceful ? 0 : r;
r = mount_verbose(m->graceful ? LOG_DEBUG : LOG_ERR, source, where, NULL, MS_BIND, NULL);
if (r < 0)