The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2860

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From 5157d4d03422015dadcc6fd94362171f8d8a43c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Fri, 15 Feb 2019 20:02:07 -0500
Subject: [PATCH] mount: Cleanup allow over-mounting
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 src/lxc/lxccontainer.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index 667674ba0b..ec58510faa 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\"", target);
+       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)
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to