diff options
author | ngie <ngie@FreeBSD.org> | 2014-11-16 06:59:58 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2014-11-16 06:59:58 +0000 |
commit | ca3d59ced083b77e4fb4f666998599a3668d3ecd (patch) | |
tree | 7e260d3a4a9f0732d92e7cbaf8966bae92e70efb /contrib/netbsd-tests | |
parent | 7e7662c9889681df6586a0bfbb41ec6d6f491b42 (diff) | |
download | FreeBSD-src-ca3d59ced083b77e4fb4f666998599a3668d3ecd.zip FreeBSD-src-ca3d59ced083b77e4fb4f666998599a3668d3ecd.tar.gz |
Call sem_unlink on semaphores before attempting to create them
Due to the lack of uniqueness in the semaphore name, and the fact that the
tests don't have cleanup routines, an interrupted test can leave a semaphore
"laying around", causing all subsequent attempts to run the test to fail
I will file a NetBSD PR for this issue soon
Diffstat (limited to 'contrib/netbsd-tests')
-rw-r--r-- | contrib/netbsd-tests/lib/librt/t_sem.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/contrib/netbsd-tests/lib/librt/t_sem.c b/contrib/netbsd-tests/lib/librt/t_sem.c index b6fc4db..e76cd52 100644 --- a/contrib/netbsd-tests/lib/librt/t_sem.c +++ b/contrib/netbsd-tests/lib/librt/t_sem.c @@ -86,6 +86,9 @@ ATF_TC_BODY(basic, tc) if (sysconf(_SC_SEMAPHORES) == -1) atf_tc_skip("POSIX semaphores not supported"); +#ifdef __FreeBSD__ + sem_unlink("/sem_b"); +#endif sem_b = sem_open("/sem_b", O_CREAT | O_EXCL, 0644, 0); ATF_REQUIRE(sem_b != SEM_FAILED); @@ -127,6 +130,9 @@ ATF_TC_BODY(child, tc) if (sysconf(_SC_SEMAPHORES) == -1) atf_tc_skip("POSIX semaphores not supported"); +#ifdef __FreeBSD__ + sem_unlink("/sem_a"); +#endif sem_a = sem_open("/sem_a", O_CREAT | O_EXCL, 0644, 0); ATF_REQUIRE(sem_a != SEM_FAILED); |