Commit 57d6d671 by Sven Wegener Committed by Daniel Lezcano

Check for existing ptmx symlink

It's OK, if /dev/ptmx points to /dev/pts/ptmx via a symlink. Signed-off-by: 's avatarSven Wegener <sven.wegener@stealer.net> Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent 9781dae8
...@@ -736,6 +736,8 @@ int setup_pivot_root(const struct lxc_rootfs *rootfs) ...@@ -736,6 +736,8 @@ int setup_pivot_root(const struct lxc_rootfs *rootfs)
static int setup_pts(int pts) static int setup_pts(int pts)
{ {
char target[PATH_MAX];
if (!pts) if (!pts)
return 0; return 0;
...@@ -757,6 +759,9 @@ static int setup_pts(int pts) ...@@ -757,6 +759,9 @@ static int setup_pts(int pts)
return -1; return -1;
} }
if (realpath("/dev/ptmx", target) && !strcmp(target, "/dev/pts/ptmx"))
goto out;
/* fallback here, /dev/pts/ptmx exists just mount bind */ /* fallback here, /dev/pts/ptmx exists just mount bind */
if (mount("/dev/pts/ptmx", "/dev/ptmx", "none", MS_BIND, 0)) { if (mount("/dev/pts/ptmx", "/dev/ptmx", "none", MS_BIND, 0)) {
SYSERROR("mount failed '/dev/pts/ptmx'->'/dev/ptmx'"); SYSERROR("mount failed '/dev/pts/ptmx'->'/dev/ptmx'");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment