mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] bug: sem_close always unmaps semaphore regardless of ref count
@ 2020-10-28 20:11 Rich Felker
  2020-10-28 20:18 ` Rich Felker
  0 siblings, 1 reply; 3+ messages in thread
From: Rich Felker @ 2020-10-28 20:11 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 198 bytes --]

I found this while reading the code during review of lock usage for
MT-fork. Test case attached (can be adapted for libc-test regression
tests, I think, or improved to be a conformance test).

Rich

[-- Attachment #2: sem_close.c --]
[-- Type: text/plain, Size: 218 bytes --]

#include <semaphore.h>

int main()
{
	char buf[] = "mysemXXXXXX";
	if (!mktemp(buf)) return 1;
	sem_t *sem = sem_open(buf, O_CREAT|O_EXCL, 0600);
	sem_open(buf, 0);
	sem_unlink(buf);
	sem_close(sem);
	sem_post(sem);
}

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-28 22:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-28 20:11 [musl] bug: sem_close always unmaps semaphore regardless of ref count Rich Felker
2020-10-28 20:18 ` Rich Felker
2020-10-28 22:01   ` Szabolcs Nagy

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).