]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
conf: close fd in lxc_setup_devpts() 1528/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 28 Apr 2017 11:52:43 +0000 (13:52 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 28 Apr 2017 13:19:17 +0000 (15:19 +0200)
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>
src/lxc/conf.c

index fc7fb183c7385ae08edcea403f7a62ea9c5b1f93..eb92b5cd4ef975b9d6f607bd376f798ef02ed60b 100644 (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;