In both tests the parent closes two pipe ends manually, then calls
sync_pipes_close() which closes all four. This results in a double-close
on two fds. Let's remove sync_pipes_close()t  and manually close the two
still open fds.

https://virtuozzo.atlassian.net/browse/VSTOR-129744
Fixes: 4fe045fa7c00a ("selftests/ve: regression test for CLONE_NEWVE owner 
correctness")
Signed-off-by: Pavel Tikhomirov <[email protected]>
---
 tools/testing/selftests/ve/ve_ns_owner_test.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/tools/testing/selftests/ve/ve_ns_owner_test.c 
b/tools/testing/selftests/ve/ve_ns_owner_test.c
index 1f82955eb4c34..d9cb66bb0df64 100644
--- a/tools/testing/selftests/ve/ve_ns_owner_test.c
+++ b/tools/testing/selftests/ve/ve_ns_owner_test.c
@@ -153,14 +153,6 @@ static int sync_pipes_init(struct sync_pipes *s)
        return 0;
 }
 
-static void sync_pipes_close(struct sync_pipes *s)
-{
-       close(s->child_to_parent[0]);
-       close(s->child_to_parent[1]);
-       close(s->parent_to_child[0]);
-       close(s->parent_to_child[1]);
-}
-
 /*
  * Per-test context shared between parent and child.
  */
@@ -344,7 +336,8 @@ TEST_F(ve_ns_owner, clone_newve_newnet_newns)
        ASSERT_TRUE(WIFEXITED(status));
        ASSERT_EQ(WEXITSTATUS(status), 0);
 
-       sync_pipes_close(&ctx.sync);
+       close(ctx.sync.child_to_parent[0]);
+       close(ctx.sync.parent_to_child[1]);
 }
 
 /*
@@ -419,7 +412,8 @@ TEST_F(ve_ns_owner, unshare_newve_newnet_newns)
        ASSERT_TRUE(WIFEXITED(status));
        ASSERT_EQ(WEXITSTATUS(status), 0);
 
-       sync_pipes_close(&ctx.sync);
+       close(ctx.sync.child_to_parent[0]);
+       close(ctx.sync.parent_to_child[1]);
 }
 
 TEST_HARNESS_MAIN
-- 
2.54.0

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to