From f7da4786892ab6b4bbe1cfedad24127a7d059f3d Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Fri, 16 Jun 2023 12:02:38 +0800
Subject: [PATCH] fix mount device path incorrect

Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---
 src/lxc/conf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index 3335b0d..a5573ac 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -6064,7 +6064,8 @@ static int setup_populate_devs(const struct lxc_rootfs *rootfs, struct lxc_list
 
 			// Unprivileged containers cannot create devices, so
 			// try to bind mount the device from the host
-			ret = snprintf(hostpath, MAXPATHLEN, "/dev/%s", dev_elem->name);
+			// dev_elem name is the device path
+			ret = snprintf(hostpath, MAXPATHLEN, "%s", dev_elem->name);
 			if (ret < 0 || ret >= MAXPATHLEN) {
 				ret = -1;
 				goto reset_umask;
-- 
2.25.1

