]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix nptl/tst-sem4: always start with a fresh semaphore.
authorTorvald Riegel <triegel@redhat.com>
Tue, 29 Jul 2014 19:44:58 +0000 (21:44 +0200)
committerTorvald Riegel <triegel@redhat.com>
Mon, 15 Dec 2014 21:14:33 +0000 (22:14 +0100)
ChangeLog
nptl/tst-sem4.c

index 07aca34dd07e582fb946e634498afc719bfd3d4e..420ce230401c72d1226b33853f14aea398893cf2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-12-15  Torvald Riegel  <triegel@redhat.com>
+
+       * nptl/tst-sem4.c (do_test): Start with a fresh semaphore state.
+
 2014-12-15  Torvald Riegel  <triegel@redhat.com>
 
        * nptl/tst-mutex5.c (do_test): Do not skip tests if elision is enabled.
index 72ed97d3701b8ac71c343511b4e1b1b9036a39d5..cf9ef2781ef2ba7a9e6f2af78166f294611f1d01 100644 (file)
@@ -39,6 +39,12 @@ do_test (void)
   pid_t pid;
   int val;
 
+  /* Start with a clean slate and register a clean-up action.  No need to
+     act if sem_unlink fails because we will catch the same problem during the
+     sem_open below.  */
+  sem_unlink ("/glibc-tst-sem4");
+  on_exit (remove_sem, (void *) "/glibc-tst-sem4");
+
   s = sem_open ("/glibc-tst-sem4", O_CREAT, 0600, 1);
   if (s == SEM_FAILED)
     {
@@ -59,8 +65,6 @@ do_test (void)
       return 1;
     }
 
-  on_exit (remove_sem, (void *) "/glibc-tst-sem4");
-
   /* We have the semaphore object.  Now try again with O_EXCL, this
      should fail.  */
   s2 = sem_open ("/glibc-tst-sem4", O_CREAT | O_EXCL, 0600, 1);