[CRIU] [PATCH 8/9] zdtm: Add /dev/tty into construct_root and prepare_mntns

Cyrill Gorcunov gorcunov at openvz.org
Fri Mar 6 02:39:24 PST 2015


We will need it for tty testing.

Based-on-patch-by: Andrey Vagin <avagin at openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 test/zdtm.sh       | 3 +++
 test/zdtm/lib/ns.c | 8 ++++++++
 2 files changed, 11 insertions(+)

diff --git a/test/zdtm.sh b/test/zdtm.sh
index 878bfaefcef0..a5c87ce87b65 100755
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -472,6 +472,9 @@ construct_root()
 		done
 	done
 
+	mkdir $root/dev
+	mknod -m 0666 $root/dev/tty c 5 0
+
 	# make 'tmp' dir under new root
 	mkdir -p $tmpdir
 	chmod 0777 $tmpdir
diff --git a/test/zdtm/lib/ns.c b/test/zdtm/lib/ns.c
index 4d2fd248634b..6b8e6f683f8a 100644
--- a/test/zdtm/lib/ns.c
+++ b/test/zdtm/lib/ns.c
@@ -122,6 +122,14 @@ static int prepare_mntns()
 				return -1;
 			}
 		}
+		if (access("/dev/tty", F_OK)) {
+			if (mknod("/dev/tty", 0666 | S_IFCHR, makedev(5, 0)) == 0) {
+				chmod("/dev/tty", 0666);
+			} else if (errno != EEXIST) {
+				fprintf(stderr, "mknod(/dev/tty) failed: %m\n");
+				return -1;
+			}
+		}
 		if (fchdir(dfd)) {
 			fprintf(stderr, "fchdir() failed: %m\n");
 			return -1;
-- 
1.9.3



More information about the CRIU mailing list