]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Ensure /dev/pts directory exists on pts setup
authorJean-Tiare LE BIGOT <jean-tiare.le-bigot@ovh.net>
Sat, 2 Aug 2014 13:27:13 +0000 (15:27 +0200)
committerStéphane Graber <stgraber@ubuntu.com>
Fri, 8 Aug 2014 16:20:19 +0000 (12:20 -0400)
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 <jean-tiare.le-bigot@ovh.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/conf.c

index 799f011f0622d0f48495ce717394f38394ebd78e..237bad4bc0c86a121b7b271a611ce7d1b3058384 100644 (file)
@@ -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'");