[CRIU] [PATCH] file_locks02: don't use pipe for synchronization

Andrew Vagin avagin at openvz.org
Tue Aug 25 07:24:41 PDT 2015


Signed-off-by: Andrew Vagin <avagin at openvz.org>
---
 test/zdtm/live/static/file_locks02.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/test/zdtm/live/static/file_locks02.c b/test/zdtm/live/static/file_locks02.c
index b16cb06..25ac1c6 100644
--- a/test/zdtm/live/static/file_locks02.c
+++ b/test/zdtm/live/static/file_locks02.c
@@ -64,12 +64,10 @@ static int check_file_locks(pid_t child)
 
 int main(int argc, char **argv)
 {
-	int fd, pf[2], pid;
+	int fd, pid;
 
 	test_init(argc, argv);
 
-	pipe(pf);
-
 	fd = open(filename, O_CREAT | O_RDWR, 0600);
 	if (fd < 0) {
 		err("No file");
@@ -80,12 +78,10 @@ int main(int argc, char **argv)
 
 	pid = fork();
 	if (pid == 0) {
-		read(pf[0], &pid, sizeof(pid));
+		test_waitsig();
 		exit(0);
 	}
 
-	close(pf[0]);
-
 	test_daemon();
 	test_waitsig();
 
@@ -94,7 +90,7 @@ int main(int argc, char **argv)
 	else
 		fail("Flock file locks check failed");
 
-	close(pf[1]);
+	kill(pid, SIGTERM);
 	waitpid(pid, NULL, 0);
 	close(fd);
 	unlink(filename);
-- 
2.4.3



More information about the CRIU mailing list