[lxc-devel] [lxc/master] lxc-create: Use absoule path for param '--dir'

qianfan-Zhao on Github lxc-bot at linuxcontainers.org
Mon Aug 19 01:56:42 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 366 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190818/8d9a834f/attachment.bin>
-------------- next part --------------
From 0c34deee9360c2d379dd0f246109e9e3c13aed54 Mon Sep 17 00:00:00 2001
From: qianfan Zhao <qianfanguijin at 163.com>
Date: Mon, 19 Aug 2019 09:54:34 +0800
Subject: [PATCH] lxc-create: Use absoule path for param '--dir'

Fix: #3123

Signed-off-by: qianfan Zhao <qianfanguijin at 163.com>
---
 src/lxc/tools/lxc_create.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/lxc/tools/lxc_create.c b/src/lxc/tools/lxc_create.c
index 4bafbd9aa2..0309562c29 100644
--- a/src/lxc/tools/lxc_create.c
+++ b/src/lxc/tools/lxc_create.c
@@ -235,6 +235,11 @@ int main(int argc, char *argv[])
 		exit(EXIT_FAILURE);
 	}
 
+	if (my_args.dir && my_args.dir[0] != '/') {
+		ERROR("--dir should use absolute path");
+		exit(EXIT_FAILURE);
+	}
+
 	if (strncmp(my_args.template, "none", strlen(my_args.template)) == 0)
 		my_args.template = NULL;
 


More information about the lxc-devel mailing list