mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-15 22:41:38 +00:00
Merge pull request #2502 from brauner/2018-07-27/fix_max_devpts_option
conf: mount devpts without "max" on EINVAL
This commit is contained in:
commit
e6b4213b9e
@ -1612,7 +1612,7 @@ static const struct id_map *find_mapped_nsid_entry(struct lxc_conf *conf, unsign
|
||||
static int lxc_setup_devpts(struct lxc_conf *conf)
|
||||
{
|
||||
int ret;
|
||||
const char *default_devpts_mntopts = "gid=5,newinstance,ptmxmode=0666,mode=0620";
|
||||
char default_devpts_mntopts[] = "gid=5,newinstance,ptmxmode=0666,mode=0620";
|
||||
char devpts_mntopts[256];
|
||||
|
||||
if (conf->pty_max <= 0) {
|
||||
@ -1642,9 +1642,20 @@ static int lxc_setup_devpts(struct lxc_conf *conf)
|
||||
/* mount new devpts instance */
|
||||
ret = mount("devpts", "/dev/pts", "devpts", MS_NOSUID | MS_NOEXEC, devpts_mntopts);
|
||||
if (ret < 0) {
|
||||
/* try mounting without "max" */
|
||||
if (errno == EINVAL) {
|
||||
devpts_mntopts[sizeof(default_devpts_mntopts) - 1] = '\0';
|
||||
ret = mount("devpts", "/dev/pts", "devpts",
|
||||
MS_NOSUID | MS_NOEXEC, devpts_mntopts);
|
||||
if (ret < 0) {
|
||||
SYSERROR("Failed to mount new devpts instance");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* try mounting without gid=5 */
|
||||
ret = mount("devpts", "/dev/pts", "devpts",
|
||||
MS_NOSUID | MS_NOEXEC, devpts_mntopts + sizeof("gid=5"));
|
||||
ret = mount("devpts", "/dev/pts", "devpts", MS_NOSUID | MS_NOEXEC,
|
||||
devpts_mntopts + sizeof("gid=5"));
|
||||
if (ret < 0) {
|
||||
SYSERROR("Failed to mount new devpts instance");
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user