From d17249766b7e2de7246b5c2bfcd30dca2da6d38e Mon Sep 17 00:00:00 2001 From: LiFeng Date: Wed, 31 Jul 2019 05:24:11 -0400 Subject: [PATCH 117/122] pupulate device with dir mode 750 and set uid/gid Signed-off-by: LiFeng --- 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 d9a7aae..0b10a2d 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 01fc944..3a02e09 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); -- 1.8.3.1