mirror of
https://github.com/ianlancetaylor/libbacktrace.git
synced 2026-04-05 17:09:06 +08:00
libbacktrace: treat EACCESS like ENOENT
For https://gcc.gnu.org/PR95061
This commit is contained in:
6
posix.c
6
posix.c
@@ -67,7 +67,11 @@ backtrace_open (const char *filename, backtrace_error_callback error_callback,
|
|||||||
descriptor = open (filename, (int) (O_RDONLY | O_BINARY | O_CLOEXEC));
|
descriptor = open (filename, (int) (O_RDONLY | O_BINARY | O_CLOEXEC));
|
||||||
if (descriptor < 0)
|
if (descriptor < 0)
|
||||||
{
|
{
|
||||||
if (does_not_exist != NULL && errno == ENOENT)
|
/* If DOES_NOT_EXIST is not NULL, then don't call ERROR_CALLBACK
|
||||||
|
if the file does not exist. We treat lacking permission to
|
||||||
|
open the file as the file not existing; this case arises when
|
||||||
|
running the libgo syscall package tests as root. */
|
||||||
|
if (does_not_exist != NULL && (errno == ENOENT || errno == EACCES))
|
||||||
*does_not_exist = 1;
|
*does_not_exist = 1;
|
||||||
else
|
else
|
||||||
error_callback (data, filename, errno);
|
error_callback (data, filename, errno);
|
||||||
|
|||||||
Reference in New Issue
Block a user