]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Check for existing ptmx symlink
authorSven Wegener <sven.wegener@stealer.net>
Mon, 23 May 2011 21:12:24 +0000 (23:12 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Mon, 23 May 2011 21:12:24 +0000 (23:12 +0200)
It's OK, if /dev/ptmx points to /dev/pts/ptmx via a symlink.

Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/conf.c

index 62b3727e9c05609ea78afacbc435c82c7ece4f78..483d37560b12b929a0057f5ba6f923a5e5bca4a8 100644 (file)
@@ -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'");