Merge pull request #1528 from brauner/2017-04-28/close_fd_in_lxc_setup_devpts

conf: close fd in lxc_setup_devpts()
This commit is contained in:
Serge Hallyn 2017-04-28 09:44:08 -05:00 committed by GitHub
commit 1545a1f163

View File

@ -1428,10 +1428,11 @@ static int lxc_setup_devpts(int num_pts)
SYSERROR("failed to create dummy \"/dev/ptmx\" file as bind mount target");
return -1;
}
close(ret);
DEBUG("created dummy \"/dev/ptmx\" file as bind mount target");
/* Fallback option: create symlink /dev/ptmx -> /dev/pts/ptmx */
ret = mount("/dev/pts/ptmx", "/dev/ptmx", "none", MS_BIND, 0);
ret = mount("/dev/pts/ptmx", "/dev/ptmx", NULL, MS_BIND, NULL);
if (!ret) {
DEBUG("bind mounted \"/dev/pts/ptmx\" to \"/dev/ptmx\"");
return 0;