lxc/0065-fix-mount-device-path-incorrect.patch
zhangxiaoyu 628f3e4012 fix mount device path incorrect
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
(cherry picked from commit 4e25f7ca15d12ff61b3880f0b1a0ffbecfe38e89)
2023-06-20 20:24:24 +08:00

28 lines
926 B
Diff

From e461e117238420ba9abdc4c9ec6de46b690354e8 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 b31ba38..51e4bb0 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -4301,7 +4301,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