about summary refs log tree commit diff
path: root/src/stdlib
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-08-07 00:05:01 -0400
committerRich Felker <dalias@aerifal.cx>2011-08-07 00:05:01 -0400
commit188ebf51b4ef58aa0ce0a3a09ed1756d6db2e2dd (patch)
treeb844ab40d69e87cb340eba3efb94f882046b17b4 /src/stdlib
parent8426a99048261b998a27557cf34f81626ffe9f12 (diff)
downloadmusl-188ebf51b4ef58aa0ce0a3a09ed1756d6db2e2dd.tar.gz
musl-188ebf51b4ef58aa0ce0a3a09ed1756d6db2e2dd.tar.xz
musl-188ebf51b4ef58aa0ce0a3a09ed1756d6db2e2dd.zip
close should not be cancellable after "failing" with EINTR
normally we allow cancellation to be acted upon when a syscall fails
with EINTR, since there is no useful status to report to the caller in
this case, and the signal that caused the interruption was almost
surely the cancellation request, anyway.

however, unlike all other syscalls, close has actually performed its
resource-deallocation function whenever it returns, even when it
returned an error. if we allow cancellation at this point, the caller
has no way of informing the program that the file descriptor was
closed, and the program may later try to close the file descriptor
again, possibly closing a different, newly-opened file.

the workaround looks ugly (special-casing one syscall), but it's
actually the case that close is the one and only syscall (at least
among cancellation points) with this ugly property.
Diffstat (limited to 'src/stdlib')
0 files changed, 0 insertions, 0 deletions