Unverified Commit 7a8959d5 by Christian Brauner Committed by GitHub

Merge pull request #2860 from stgraber/master

mount: Allow over-mounting
parents eba282e4 71521317
...@@ -4970,7 +4970,10 @@ static int create_mount_target(const char *dest, mode_t st_mode) ...@@ -4970,7 +4970,10 @@ static int create_mount_target(const char *dest, mode_t st_mode)
ret = mkdir(dest, 0000); ret = mkdir(dest, 0000);
else else
ret = mknod(dest, S_IFREG | 0000, 0); ret = mknod(dest, S_IFREG | 0000, 0);
if (ret < 0) {
if (ret == 0)
TRACE("Created mount target \"%s\"", dest);
else if (ret < 0 && ret != EEXIST) {
SYSERROR("Failed to create mount target \"%s\"", dest); SYSERROR("Failed to create mount target \"%s\"", dest);
return -1; return -1;
} }
...@@ -5071,12 +5074,9 @@ static int do_lxcapi_mount(struct lxc_container *c, const char *source, ...@@ -5071,12 +5074,9 @@ static int do_lxcapi_mount(struct lxc_container *c, const char *source,
_exit(EXIT_FAILURE); _exit(EXIT_FAILURE);
} }
if (access(target, F_OK) < 0 && errno == ENOENT) { ret = create_mount_target(target, sb.st_mode);
ret = create_mount_target(target, sb.st_mode); if (ret < 0)
if (ret < 0) _exit(EXIT_FAILURE);
_exit(EXIT_FAILURE);
TRACE("Created mount target \"%s\"", target);
}
suff = strrchr(template, '/'); suff = strrchr(template, '/');
if (!suff) if (!suff)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment