From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: Florian Weimer <fweimer@redhat.com>,
Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org>
Cc: Paul Eggert <eggert@cs.ucla.edu>
Subject: Re: [PATCH v2] linux: Make fdopendir fail with O_PATH (BZ 30373)
Date: Thu, 30 Nov 2023 08:51:49 -0300 [thread overview]
Message-ID: <34dac04c-4bc6-46cd-96d7-4e1ebe4d1f18@linaro.org> (raw)
In-Reply-To: <875y1jwopw.fsf@oldenburg.str.redhat.com>
On 30/11/23 06:54, Florian Weimer wrote:
> * Adhemerval Zanella via Libc-alpha:
>
>> diff --git a/sysdeps/unix/sysv/linux/fdopendir.c b/sysdeps/unix/sysv/linux/fdopendir.c
>> index 861345396c..707fb5960e 100644
>> --- a/sysdeps/unix/sysv/linux/fdopendir.c
>> +++ b/sysdeps/unix/sysv/linux/fdopendir.c
>> @@ -37,10 +37,16 @@ __fdopendir (int fd)
>> return NULL;
>> }
>>
>> - /* Make sure the descriptor allows for reading. */
>> int flags = __fcntl64_nocancel (fd, F_GETFL);
>> if (__glibc_unlikely (flags == -1))
>> return NULL;
>> + /* Fail early for descriptors opened with O_PATH. */
>> + if (__glibc_unlikely (flags & O_PATH))
>> + {
>> + __set_errno (EBADF);
>> + return NULL;
>> + }
>
> Should we fail with EINVAL instead of EBADF?
POSIX states it should be EBADF indeed, as Paul has noted [1]. The EINVAL
returns is a different issue.
>
> Maybe add a comment that EBADF matches what readdir will fail with?
>
> Otherwise:
>
> Reviewed-by: Florian Weimer <fweimer@redhat.com>
Thanks.
>
> Thanks,
> Florian
>
[1] https://sourceware.org/pipermail/libc-alpha/2023-September/151302.html
next prev parent reply other threads:[~2023-11-30 11:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-01 12:26 Adhemerval Zanella
2023-09-01 17:57 ` Paul Eggert
2023-09-05 12:07 ` Adhemerval Zanella Netto
2023-10-02 11:09 ` Adhemerval Zanella Netto
2023-11-29 16:54 ` Adhemerval Zanella Netto
2023-11-30 9:54 ` Florian Weimer
2023-11-30 11:51 ` Adhemerval Zanella Netto [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-09-01 12:23 Adhemerval Zanella
2023-08-10 13:54 Adhemerval Zanella
2023-08-31 17:43 ` Adhemerval Zanella Netto
2023-08-31 20:21 ` Paul Eggert
2023-09-01 12:22 ` Adhemerval Zanella Netto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=34dac04c-4bc6-46cd-96d7-4e1ebe4d1f18@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=eggert@cs.ucla.edu \
--cc=fweimer@redhat.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).