diff options
author | Rich Felker <dalias@aerifal.cx> | 2020-10-28 16:13:45 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2020-10-28 16:13:45 -0400 |
commit | f70375df85d26235a45e74559afd69be59e5ff99 (patch) | |
tree | d83ea1381c3cf18c251fb7d03f6b1d11e9ad6389 /src/misc/getrusage.c | |
parent | 613ccabeb0c10ac818e36ef53e09753d23785cbf (diff) | |
download | musl-f70375df85d26235a45e74559afd69be59e5ff99.tar.gz musl-f70375df85d26235a45e74559afd69be59e5ff99.tar.bz2 musl-f70375df85d26235a45e74559afd69be59e5ff99.tar.xz musl-f70375df85d26235a45e74559afd69be59e5ff99.zip |
fix sem_close unmapping of still-referenced semaphore
sem_open is required to return the same sem_t pointer for all
references to the same named semaphore when it's opened more than once
in the same process. thus we keep a table of all the mapped semaphores
and their reference counts. the code path for sem_close checked the
reference count, but then proceeded to unmap the semaphore regardless
of whether the count had reached zero.
add an immediate unlock-and-return for the nonzero refcnt case so the
property of performing the munmap syscall after releasing the lock can
be preserved.
Diffstat (limited to 'src/misc/getrusage.c')
0 files changed, 0 insertions, 0 deletions