Commit 2ce6a6a2 authored by Andrew Vagin's avatar Andrew Vagin Committed by Pavel Emelyanov

file_locks02: don't use pipe for synchronization

Signed-off-by: 's avatarAndrew Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent f2bc172f
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment