From: Stéphane Graber Date: Sat, 16 Feb 2019 01:02:07 +0000 (-0500) Subject: mount: Cleanup allow over-mounting X-Git-Tag: lxc-3.2.0~145^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=71521317b2a4432fb5aa1878a7933d563b7020cb;p=thirdparty%2Flxc.git mount: Cleanup allow over-mounting Signed-off-by: Stéphane Graber --- diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index 667674ba0..683bf5f43 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -4970,7 +4970,10 @@ static int create_mount_target(const char *dest, mode_t st_mode) ret = mkdir(dest, 0000); else 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); return -1; } @@ -5071,12 +5074,9 @@ static int do_lxcapi_mount(struct lxc_container *c, const char *source, _exit(EXIT_FAILURE); } - if (access(target, F_OK) < 0 && errno == ENOENT) { - ret = create_mount_target(target, sb.st_mode); - if (ret < 0) - _exit(EXIT_FAILURE); - TRACE("Created mount target \"%s\"", target); - } + ret = create_mount_target(target, sb.st_mode); + if (ret < 0) + _exit(EXIT_FAILURE); suff = strrchr(template, '/'); if (!suff)