From 6f4194128b0387e19f5e7ad65bfa157f52335871 Mon Sep 17 00:00:00 2001
From: LiFeng <lifeng68@huawei.com>
Date: Wed, 31 Jul 2019 05:24:11 -0400
Subject: [PATCH 117/131] pupulate device with dir mode 750 and set uid/gid

Signed-off-by: LiFeng <lifeng68@huawei.com>
---
 src/lxc/conf.c    | 3 ---
 src/lxc/confile.c | 2 ++
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index d9a7aae1..0b10a2dd 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -4005,13 +4005,11 @@ static int setup_populate_devs(const struct lxc_rootfs *rootfs, struct lxc_list
 	int ret = 0;
 	char *pathdirname = NULL;
 	char path[MAXPATHLEN];
-	mode_t cmask;
 	mode_t file_mode = 0;
 	struct lxc_populate_devs *dev_elem = NULL;
 	struct lxc_list *it = NULL;
 
 	INFO("Populating devices into container");
-	cmask = umask(S_IXUSR | S_IXGRP | S_IXOTH);
 	lxc_list_for_each(it, devs) {
 		dev_elem = it->elem;
 
@@ -4072,7 +4070,6 @@ static int setup_populate_devs(const struct lxc_rootfs *rootfs, struct lxc_list
 			return -1;
 		}
 	}
-	umask(cmask);
 
 	INFO("Populated devices into container /dev");
 	return 0;
diff --git a/src/lxc/confile.c b/src/lxc/confile.c
index 01fc9443..3a02e099 100644
--- a/src/lxc/confile.c
+++ b/src/lxc/confile.c
@@ -2335,6 +2335,8 @@ static int set_config_populate_device(const char *key, const char *value,
 	dev_elem->file_mode = filemode;
 	dev_elem->maj = major;
 	dev_elem->min = minor;
+	dev_elem->uid = (uid_t)uid;
+	dev_elem->gid = (gid_t)gid;
 
 	lxc_list_add_elem(dev_list, dev_elem);
 
-- 
2.23.0

