[lxc-devel] [lxc/master] devpts: use max=<count> option on mount
brauner on Github
lxc-bot at linuxcontainers.org
Mon Jul 31 20:55:56 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/20170731/9d855ced/attachment.bin>
-------------- next part --------------
From d4033a97f9e12cfe8b7012400a12e09577d59a94 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Mon, 31 Jul 2017 22:54:38 +0200
Subject: [PATCH] devpts: use max=<count> option on mount
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/lxc/conf.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index ab038d36d..25d29c20a 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -1332,7 +1332,8 @@ static int setup_pivot_root(const struct lxc_rootfs *rootfs)
static int lxc_setup_devpts(int num_pts)
{
int ret;
- const char *devpts_mntopts = "newinstance,ptmxmode=0666,mode=0620,gid=5";
+ const char *default_devpts_mntopts = "newinstance,ptmxmode=0666,mode=0620,gid=5";
+ char devpts_mntopts[256];
if (!num_pts) {
DEBUG("no new devpts instance will be mounted since no pts "
@@ -1340,6 +1341,11 @@ static int lxc_setup_devpts(int num_pts)
return 0;
}
+ ret = snprintf(devpts_mntopts, sizeof(devpts_mntopts), "%s,max=%d",
+ default_devpts_mntopts, num_pts);
+ if (ret < 0 || (size_t)ret >= sizeof(devpts_mntopts))
+ return -1;
+
/* Unmount old devpts instance. */
ret = access("/dev/pts/ptmx", F_OK);
if (!ret) {
More information about the lxc-devel
mailing list