[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] LXC: Check container init path after pivot_root()



Currently we check the path before changing the root directory.
This cannot work. Do the check after pivot_root() such that
we check for the patch within the correct root.

Signed-off-by: Richard Weinberger <richard nod at>
---
 src/lxc/lxc_container.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index a003ec8..7531fea 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1948,13 +1948,6 @@ static int lxcContainerChild(void *data)
     if (lxcContainerResolveSymlinks(vmDef) < 0)
         goto cleanup;
 
-    if (!virFileExists(vmDef->os.init)) {
-        virReportSystemError(errno,
-                    _("cannot find init path '%s' relative to container root"),
-                    vmDef->os.init);
-        goto cleanup;
-    }
-
     /* Wait for interface devices to show up */
     if (lxcContainerWaitForContinue(argv->monitor) < 0) {
         virReportSystemError(errno, "%s",
@@ -1996,6 +1989,13 @@ static int lxcContainerChild(void *data)
                                    argv->securityDriver) < 0)
         goto cleanup;
 
+    if (!virFileExists(vmDef->os.init)) {
+        virReportSystemError(errno,
+                    _("cannot find init path '%s' relative to container root"),
+                    vmDef->os.init);
+        goto cleanup;
+    }
+
     /* rename and enable interfaces */
     if (lxcContainerRenameAndEnableInterfaces(!!(vmDef->features &
                                                  (1 << VIR_DOMAIN_FEATURE_PRIVNET)),
-- 
1.8.1.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]