]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
lxc: Verify root fs exists before mounting
authorCole Robinson <crobinso@redhat.com>
Thu, 2 Jun 2011 18:25:25 +0000 (14:25 -0400)
committerCole Robinson <crobinso@redhat.com>
Tue, 7 Jun 2011 18:38:54 +0000 (14:38 -0400)
Otherwise the following virFileMakePath will create the directory for
us and fail further ahead, which probably isn't intended.

src/lxc/lxc_controller.c

index c94d0d08d93553e72398fa2e238160b75b47dff6..7d60090ac8be079e82acf34b6cff7e4abb648141 100644 (file)
@@ -664,6 +664,14 @@ lxcControllerRun(virDomainDefPtr def,
      */
     if (root) {
         VIR_DEBUG("Setting up private /dev/pts");
+
+        if (!virFileExists(root->src)) {
+            virReportSystemError(errno,
+                                 _("root source %s does not exist"),
+                                 root->src);
+            goto cleanup;
+        }
+
         if (unshare(CLONE_NEWNS) < 0) {
             virReportSystemError(errno, "%s",
                                  _("Cannot unshare mount namespace"));