Skip to content

Commit d68a7ac

Browse files
libbacktrace: treat EACCESS like ENOENT
For https://gcc.gnu.org/PR95061
1 parent 14465a9 commit d68a7ac

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

posix.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ backtrace_open (const char *filename, backtrace_error_callback error_callback,
6767
descriptor = open (filename, (int) (O_RDONLY | O_BINARY | O_CLOEXEC));
6868
if (descriptor < 0)
6969
{
70-
if (does_not_exist != NULL && errno == ENOENT)
70+
/* If DOES_NOT_EXIST is not NULL, then don't call ERROR_CALLBACK
71+
if the file does not exist. We treat lacking permission to
72+
open the file as the file not existing; this case arises when
73+
running the libgo syscall package tests as root. */
74+
if (does_not_exist != NULL && (errno == ENOENT || errno == EACCES))
7175
*does_not_exist = 1;
7276
else
7377
error_callback (data, filename, errno);

0 commit comments

Comments
 (0)