[CRIU] [PATCH] zdtm/fifo_wronly: wait when a child opens a file descriptor

Andrey Vagin avagin at openvz.org
Tue Dec 22 20:46:46 PST 2015


From: Andrew Vagin <avagin at virtuozzo.com>

A static test should not change its state during C/R

Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
 test/zdtm/live/static/fifo_wronly.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/test/zdtm/live/static/fifo_wronly.c b/test/zdtm/live/static/fifo_wronly.c
index fb18b78..2fbd69e 100644
--- a/test/zdtm/live/static/fifo_wronly.c
+++ b/test/zdtm/live/static/fifo_wronly.c
@@ -18,6 +18,7 @@ TEST_OPTION(filename, string, "file name", 1);
 
 int main(int argc, char **argv)
 {
+	task_waiter_t t;
 	int fd, fd1;
 	struct stat st;
 	mode_t mode = S_IFIFO | 0600;
@@ -26,6 +27,8 @@ int main(int argc, char **argv)
 
 	test_init(argc, argv);
 
+	task_waiter_init(&t);
+
 	if (mknod(filename, mode, 0)) {
 		pr_perror("can't make fifo \"%s\"", filename);
 		exit(1);
@@ -46,6 +49,7 @@ int main(int argc, char **argv)
 			chret = errno;
 			return chret;
 		}
+		task_waiter_complete(&t, 1);
 		res = read(fd1, rbuf, 7);
 		if (res < 0) {
 			pr_perror("read error %s", filename);
@@ -71,6 +75,7 @@ int main(int argc, char **argv)
 			wait(NULL);
 			return 1;
 		}
+		task_waiter_wait4(&t, 1);
 
 		test_daemon();
 		test_waitsig();
-- 
2.4.3



More information about the CRIU mailing list