From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32493 invoked by alias); 5 Dec 2014 19:03:48 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 32482 invoked by uid 89); 5 Dec 2014 19:03:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Subject: [PATCH 2/3] Fix nptl/tst-sem4: always start with a fresh semaphore. From: Torvald Riegel To: GLIBC Devel In-Reply-To: <1417804668.22797.108.camel@triegel.csb> References: <1417804668.22797.108.camel@triegel.csb> Content-Type: multipart/mixed; boundary="=-pPH5fkwqeRRle2AkAGFt" Date: Fri, 05 Dec 2014 19:03:00 -0000 Message-ID: <1417806222.25868.6.camel@triegel.csb> Mime-Version: 1.0 X-SW-Source: 2014-12/txt/msg00158.txt.bz2 --=-pPH5fkwqeRRle2AkAGFt Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Content-length: 98 This just makes sure that if this test fails, new runs of the test will start from a fresh state. --=-pPH5fkwqeRRle2AkAGFt Content-Disposition: attachment; filename="sem-test2.patch" Content-Type: text/x-patch; name="sem-test2.patch"; charset="UTF-8" Content-Transfer-Encoding: 7bit Content-length: 1001 commit 1ba62510cc2f1459147ec31dda28d45c2ee96abf Author: Torvald Riegel Date: Tue Jul 29 21:44:58 2014 +0200 Fix nptl/tst-sem4: always start with a fresh semaphore. diff --git a/nptl/tst-sem4.c b/nptl/tst-sem4.c index 72ed97d..5e17d03 100644 --- a/nptl/tst-sem4.c +++ b/nptl/tst-sem4.c @@ -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 well 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); --=-pPH5fkwqeRRle2AkAGFt--