[lxc-devel] [PATCH] Check for existing ptmx symlink
Sven Wegener
sven.wegener at stealer.net
Sat May 21 18:35:04 UTC 2011
It's OK, if /dev/ptmx points to /dev/pts/ptmx via a symlink.
Signed-off-by: Sven Wegener <sven.wegener at stealer.net>
---
src/lxc/conf.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index 62b3727..483d375 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -752,6 +752,8 @@ int setup_pivot_root(const struct lxc_rootfs *rootfs)
static int setup_pts(int pts)
{
+ char target[PATH_MAX];
+
if (!pts)
return 0;
@@ -773,6 +775,9 @@ static int setup_pts(int pts)
return -1;
}
+ if (realpath("/dev/ptmx", target) && !strcmp(target, "/dev/pts/ptmx"))
+ goto out;
+
/* fallback here, /dev/pts/ptmx exists just mount bind */
if (mount("/dev/pts/ptmx", "/dev/ptmx", "none", MS_BIND, 0)) {
SYSERROR("mount failed '/dev/pts/ptmx'->'/dev/ptmx'");
--
1.7.4.5
More information about the lxc-devel
mailing list