summaryrefslogtreecommitdiff
path: root/nptl/tst-cancel20.c
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/tst-cancel20.c')
-rw-r--r--nptl/tst-cancel20.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/nptl/tst-cancel20.c b/nptl/tst-cancel20.c
index 51b558e98d..b735fe8ea1 100644
--- a/nptl/tst-cancel20.c
+++ b/nptl/tst-cancel20.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -145,12 +145,6 @@ do_one_test (void)
return 1;
}
- /* This will cause the read in the child to return. */
- close (fd[0]);
- close (fd[1]);
- close (fd[2]);
- close (fd[3]);
-
void *ret;
if (pthread_join (th, &ret) != 0)
{
@@ -170,6 +164,15 @@ do_one_test (void)
return 1;
}
+ /* The pipe closing must be issued after the cancellation handling to avoid
+ a race condition where the cancellation runs after both pipe ends are
+ closed. In this case the read syscall returns EOF and the cancellation
+ must not act. */
+ close (fd[0]);
+ close (fd[1]);
+ close (fd[2]);
+ close (fd[3]);
+
return 0;
}