Skip to content

Commit

Permalink
conf: close fd in lxc_setup_devpts()
Browse files Browse the repository at this point in the history
This left the file descriptor to the underlying /dev/ptmx file open which
confused the hell out of criu. Let's close it.

Closes https://github.com/lxc/lxd/issues/3243.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Apr 28, 2017
1 parent da1ef68 commit e87bd19
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lxc/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e87bd19

Please sign in to comment.