From: Jean-Tiare LE BIGOT Date: Sat, 2 Aug 2014 13:27:13 +0000 (+0200) Subject: Ensure /dev/pts directory exists on pts setup X-Git-Tag: lxc-1.1.0.alpha2~87 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e40254ab7e85bca548948c3fa02c6ed0169ec73;p=thirdparty%2Flxc.git Ensure /dev/pts directory exists on pts setup When `lxc.autodev = 0` and empty tmpfs is mounted on /dev and private pts are requested, we need to ensure '/dev/pts' exists before attempting to mount devpts on it. Signed-off-by: Jean-Tiare LE BIGOT Acked-by: Stéphane Graber --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 799f011f0..237bad4bc 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -1605,6 +1605,13 @@ static int setup_pts(int pts) return -1; } + if (mkdir("/dev/pts", 0755)) { + if ( errno != EEXIST ) { + SYSERROR("failed to create '/dev/pts'"); + return -1; + } + } + if (mount("devpts", "/dev/pts", "devpts", MS_MGC_VAL, "newinstance,ptmxmode=0666,mode=0620,gid=5")) { SYSERROR("failed to mount a new instance of '/dev/pts'");