]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
lxc: Ensure container <init> actually exists
authorCole Robinson <crobinso@redhat.com>
Thu, 2 Jun 2011 19:25:21 +0000 (15:25 -0400)
committerCole Robinson <crobinso@redhat.com>
Tue, 7 Jun 2011 18:38:54 +0000 (14:38 -0400)
Since we can't really get useful error reporting from virCommandExec since
it needs to be the last thing we do.

src/lxc/lxc_container.c

index 26b493ec81d9a40377d934916884a5cc5609eb81..7924858879693de9f65ddce0a982af4d064c5729 100644 (file)
@@ -785,6 +785,13 @@ static int lxcContainerChild( void *data )
     if (lxcContainerSetupMounts(vmDef, root) < 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",