[lxc-devel] [lxc/master] conf: close fd in lxc_setup_devpts()
brauner on Github
lxc-bot at linuxcontainers.org
Fri Apr 28 11:53:26 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170428/6fa9b0f5/attachment.bin>
-------------- next part --------------
From 88431c021b03e68cf83f5a50e8ffadc5f5237684 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Fri, 28 Apr 2017 13:52:43 +0200
Subject: [PATCH] conf: close fd in lxc_setup_devpts()
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/lxc/conf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index fc7fb18..eb92b5c 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -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;
More information about the lxc-devel
mailing list