]> 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>
Fri, 27 May 2011 08:19:09 +0000 (10:19 +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 f73eaac8d5aea03f810b0f06ce30fbd23ec9b879..044d35cb33ef6a42804bad99abb148418ae25f52 100644 (file)
@@ -736,6 +736,8 @@ int setup_pivot_root(const struct lxc_rootfs *rootfs)
 
 static int setup_pts(int pts)
 {
+       char target[PATH_MAX];
+
        if (!pts)
                return 0;
 
@@ -757,6 +759,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'");