Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 4 Aug 2022 14:42:49 +0200
From: Sascha Brawer <sascha@...wer.ch>
To: musl@...ts.openwall.com
Subject: Should fdopen() check the passed file descriptor?

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.
https://pubs.opengroup.org/onlinepubs/009696899/functions/fdopen.html

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, sascha@...wer.ch

Content of type "text/html" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.