public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: [committed] libstdc++: Handle EPERM for filesystem access errors on MacOS [PR 99537]
Date: Thu, 11 Mar 2021 18:20:56 +0000	[thread overview]
Message-ID: <20210311182056.GI3008@redhat.com> (raw)
In-Reply-To: <YEpZN45U5vyamlfq@redhat.com>

On 11/03/21 17:54 +0000, Jonathan Wakely wrote:
>Contrary to what POSIX says, some directory operations on MacOS can fail
>with EPERM instead of EACCES, so we need to handle both.
>
>libstdc++-v3/ChangeLog:
>
>	PR libstdc++/99537

Oh drat, that's the wrong PR number. It should be PR 99533, as the
comment says in the code. I'll fix the ChangeLog tomorrow.

>	* src/c++17/fs_dir.cc (recursive_directory_iterator): Use new
>	helper function to check for permission denied errors.
>	* src/filesystem/dir.cc (recursive_directory_iterator):
>	Likewise.
>	* src/filesystem/dir-common.h (is_permission_denied_error): New
>	helper function.



>--- a/libstdc++-v3/src/filesystem/dir-common.h
>+++ b/libstdc++-v3/src/filesystem/dir-common.h
>@@ -141,6 +141,18 @@ struct _Dir_base
>   posix::DIR*	dirp;
> };
>
>+inline bool
>+is_permission_denied_error(int e)
>+{
>+  if (e == EACCES)
>+    return true;
>+#ifdef __APPLE__
>+  if (e == EPERM) // See PR 99533
>+    return true;
>+#endif
>+  return false;
>+}
>+
> } // namespace filesystem
>
> // BEGIN/END macros must be defined before including this file.


      reply	other threads:[~2021-03-11 18:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 17:53 Jonathan Wakely
2021-03-11 18:20 ` Jonathan Wakely [this message]

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=20210311182056.GI3008@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.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).