diff options
author | Maciej Wereski <m.wereski@partner.samsung.com> | 2013-08-21 16:43:55 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-08-23 12:48:14 -0400 |
commit | ea92ae33e0fbbf8a98cd2e08ca5a850d83d57fae (patch) | |
tree | 9a4285fc26e58f99c41d8d7bed8e60732ff4227c /src/core | |
parent | ac8e20c6e95975316279740778f381ad50a1a21a (diff) |
"-" prefix for InaccessibleDirectories and ReadOnlyDirectories
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/namespace.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/core/namespace.c b/src/core/namespace.c index 7e33d84156..16b132ba56 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -51,6 +51,7 @@ typedef struct BindMount { const char *path; MountMode mode; bool done; + bool ignore; } BindMount; static int append_mounts(BindMount **p, char **strv, MountMode mode) { @@ -58,6 +59,13 @@ static int append_mounts(BindMount **p, char **strv, MountMode mode) { STRV_FOREACH(i, strv) { + (*p)->ignore = false; + + if ((mode == INACCESSIBLE || mode == READONLY) && (*i)[0] == '-') { + (*p)->ignore = true; + (*i)++; + } + if (!path_is_absolute(*i)) return -EINVAL; @@ -155,6 +163,8 @@ static int apply_mount( r = mount(what, m->path, NULL, MS_BIND|MS_REC, NULL); if (r >= 0) log_debug("Successfully mounted %s to %s", what, m->path); + else if (m->ignore && errno == ENOENT) + r = 0; return r; } @@ -168,7 +178,7 @@ static int make_read_only(BindMount *m) { return 0; r = mount(NULL, m->path, NULL, MS_BIND|MS_REMOUNT|MS_RDONLY|MS_REC, NULL); - if (r < 0) + if (r < 0 && !(m->ignore && errno == ENOENT)) return -errno; return 0; |