From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=HTML_MESSAGE, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 15567 invoked from network); 4 Aug 2022 13:44:38 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 4 Aug 2022 13:44:38 -0000 Received: (qmail 18268 invoked by uid 550); 4 Aug 2022 13:44:35 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 1343 invoked from network); 4 Aug 2022 12:43:12 -0000 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc; bh=Q9JlE1vBkquvbiIYYmRZgaqGZzXJH9z6IMWz6f8O9m8=; b=6HnAdYMTXK03y6jYVfruF1zDKs/Kb9SM59TSc0Q8HvRcHnwWyRWVNT7iguZyI7HR45 zIjs74WuK4yYXAJok1i8j+hES9Sa2k2cyESebVGH1jQ3CdgKaJTeKYtJBCfHpXFlbh5y tLaVagISvS28SVP4kIkXegdUofGKOtSOjJWJHNoJMtPE7kY1PcmPioCb9WMJCnGJ68ir CO92pnbUE4NoTWK6XP8+cCdxzvemhAB7YfD6Qef23qUu3SV7IvJK+vtyIRRwnPjomkz0 tRZ23MLfq7BY1eUMNWPaxG7bQ0Wugl5mOZXd+tjtPWcMO6ef/G6Y1QNy1Ka/fgVAjMIk Ai/g== X-Gm-Message-State: ACgBeo13DFzLGfGnzLHtLVvGMsA9DUufj/n/B8punzuTWo9Gn4OZmeBc lJ0iX2PKI1820DK5GEKQoqTkqvojZ4Z4MO8VqwL0EMQrpqg= X-Google-Smtp-Source: AA6agR5V+nNY47AMPxkQgDEy+cRsvw4Xk01rKl8pDFrOEyV5pHNYi3Gb6R6JGKg6N8EYKw2xqOP5inEggapLYnIbc3I= X-Received: by 2002:a17:902:a604:b0:16d:9bde:8657 with SMTP id u4-20020a170902a60400b0016d9bde8657mr1754697plq.17.1659616980250; Thu, 04 Aug 2022 05:43:00 -0700 (PDT) MIME-Version: 1.0 From: Sascha Brawer Date: Thu, 4 Aug 2022 14:42:49 +0200 Message-ID: To: musl@lists.openwall.com Content-Type: multipart/alternative; boundary="00000000000092348a05e569b03e" Subject: [musl] Should fdopen() check the passed file descriptor? --00000000000092348a05e569b03e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Dear list Should musl=E2=80=99s fdopen() verify whether the passed file descriptor re= fers to an open file? glibc seems to do that, whereas musl doesn=E2=80=99t. 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=E2=80=99m pat= ching the user library so it tests for fcntl(fd, F_GETFD) < 0 before invoking fdopen(). But I wonder if this check shouldn=E2=80=99t rather be done withi= n musl itself. What do you think? Thanks for cc=E2=80=99ing me on your thoughts, I=E2=80=99m not subscribed t= o the musl mailing list. Best, =E2=80=94 Sascha Brawer, sascha@brawer.ch --00000000000092348a05e569b03e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Dear list

Should musl=E2=80=99s=C2=A0fd= open() verify whether the passed file descriptor refers to an open file? gl= ibc seems to do that, whereas musl doesn=E2=80=99t.

According to the spec,=C2=A0fdopen "may" fail with EBADF if a b= ad 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=E2=80=99m pa= tching the user library so it tests for fcntl(fd, F_GETFD) < 0 before in= voking fdopen(). But I wonder if this check shouldn=E2=80=99t rather be don= e within musl itself. What=C2=A0do you think?

Than= ks for cc=E2=80=99ing me on your thoughts, I=E2=80=99m not subscribed=C2=A0= to the musl mailing list. Best,

=E2=80=94 Sascha B= rawer, sascha@brawer.ch
<= br>


--00000000000092348a05e569b03e--