From 4fb706a5a7a8133e8bbddcfba57d7dcf373b7888 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Thu, 2 Jun 2011 14:25:25 -0400 Subject: [PATCH] lxc: Verify root fs exists before mounting Otherwise the following virFileMakePath will create the directory for us and fail further ahead, which probably isn't intended. --- src/lxc/lxc_controller.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index c94d0d08d9..7d60090ac8 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -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"));