From f99c7aa5de9aa1aa7d624380235cbd295a4764b8 Mon Sep 17 00:00:00 2001 From: Serge Hallyn Date: Wed, 5 Dec 2012 10:38:07 -0600 Subject: [PATCH] lxc-create: refuse to use a custom rootfs (--dir) which already exists. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Serge Hallyn Acked-by: Stéphane Graber --- src/lxc/lxc-create.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lxc/lxc-create.in b/src/lxc/lxc-create.in index 650a245a3..3c66bfa7b 100644 --- a/src/lxc/lxc-create.in +++ b/src/lxc/lxc-create.in @@ -313,6 +313,10 @@ if [ -n "$custom_rootfs" ]; then echo "configuration file already specifies a lxc.rootfs" exit 1 fi + if [ -d "$custom_rootfs" ]; then + echo "specified rootfs ($custom_rootfs) already exists. Bailing." + exit 1 + fi echo "lxc.rootfs = $custom_rootfs" >> $lxc_path/$lxc_name/config fi