According to docs, mknod clears each permission bit whose
corresponding bit in the process umask is set, so we should fix it
before creating device nodes.
Signed-off-by: Alexander Vladimirov <alexander.idkfa.vladimirov@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
struct lxc_devs *d;
char path[MAXPATHLEN];
int i;
+ mode_t cmask;
INFO("Creating initial consoles under %s/dev\n", root);
run_makedev(path);
INFO("Populating /dev under %s\n", root);
+ cmask = umask(S_IXUSR | S_IXGRP | S_IXOTH);
for (i = 0; i < sizeof(lxc_devs) / sizeof(lxc_devs[0]); i++) {
d = &lxc_devs[i];
ret = snprintf(path, MAXPATHLEN, "%s/dev/%s", root, d->name);
return -1;
}
}
+ umask(cmask);
INFO("Populated /dev under %s\n", root);
return 0;