From: Sven Wegener Date: Mon, 23 May 2011 21:12:24 +0000 (+0200) Subject: Check for existing ptmx symlink X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=57d6d6718dab8913039cb5fba74771e36cdeb5df;p=thirdparty%2Flxc.git Check for existing ptmx symlink It's OK, if /dev/ptmx points to /dev/pts/ptmx via a symlink. Signed-off-by: Sven Wegener Signed-off-by: Daniel Lezcano --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index f73eaac8d..044d35cb3 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -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'");