mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] aio_close needed in dup2?
@ 2023-10-12 16:43 Markus Wichmann
  2023-10-12 17:43 ` Rich Felker
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Wichmann @ 2023-10-12 16:43 UTC (permalink / raw)
  To: musl

Hi all,

I noticed something today: In close(), we call __aio_close() to both
prevent AIO from using invalid file descriptors and implement the
requirement that outstanding AIO be cancelled. But in dup2() and dup3(),
that doesn't happen.

POSIX only says that dup2() closes newfd if it already is a valid file
descriptor. While not explicitly stated, I can't really find a sensible
interpretation of that requirement that is different from "as if by way
of close()". POSIX has no concept of closing file descriptors in any
other way. And dup3() is an extension function, but I think most
programmers will understand it to be an extension of dup2(), so the same
argument applies there.

So, do we need to call __aio_close() in dup2() and dup3()?

Ciao,
Markus

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

end of thread, other threads:[~2023-10-12 23:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-12 16:43 [musl] aio_close needed in dup2? Markus Wichmann
2023-10-12 17:43 ` Rich Felker
2023-10-12 23:40   ` Gabriel Ravier

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).