mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] Should fdopen() check the passed file descriptor?
@ 2022-08-04 12:42 Sascha Brawer
  2022-08-04 14:23 ` Markus Wichmann
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Brawer @ 2022-08-04 12:42 UTC (permalink / raw)
  To: musl

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

Dear list

Should musl’s fdopen() verify whether the passed file descriptor refers to
an open file? glibc seems to do that, whereas musl doesn’t.

According to the spec, fdopen "may" fail with EBADF if a bad file
descriptor is passed.

I just ran into this difference while porting some user library (libosmium,
for OpenStreetMap) to Alpine Linux which uses musl. For now I’m patching
the user library so it tests for fcntl(fd, F_GETFD) < 0 before invoking
fdopen(). But I wonder if this check shouldn’t rather be done within musl
itself. What do you think?

Thanks for cc’ing me on your thoughts, I’m not subscribed to the musl
mailing list. Best,

— Sascha Brawer,

[-- Attachment #2: Type: text/html, Size: 1108 bytes --]

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

end of thread, other threads:[~2022-08-04 16:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-04 12:42 [musl] Should fdopen() check the passed file descriptor? Sascha Brawer
2022-08-04 14:23 ` Markus Wichmann
2022-08-04 16:09   ` Rich Felker

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

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