diff options
author | Ian Lance Taylor <iant@golang.org> | 2020-05-13 10:18:45 -0700 |
---|---|---|
committer | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-17 13:03:15 -0300 |
commit | a2e8aa542e984127e56238c320059fddd44658bb (patch) | |
tree | 5c1131f667122779dc03efb3f0053485dd21c3b2 | |
parent | e375c4e9844d4c9de30bc5552aff68842165262e (diff) | |
download | gcc-a2e8aa542e984127e56238c320059fddd44658bb.zip gcc-a2e8aa542e984127e56238c320059fddd44658bb.tar.gz gcc-a2e8aa542e984127e56238c320059fddd44658bb.tar.bz2 |
libbacktrace: treat EACCESS like ENOENT
libbacktrace/
PR go/95061
* posix.c (backtrace_open): Treat EACCESS like ENOENT.
-rw-r--r-- | libbacktrace/ChangeLog | 6 | ||||
-rw-r--r-- | libbacktrace/posix.c | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog index 9668906..89b690d 100644 --- a/libbacktrace/ChangeLog +++ b/libbacktrace/ChangeLog @@ -1,3 +1,9 @@ +2020-05-13 Ian Lance Taylor <iant@golang.org> + + PR go/95061 + * posix.c (backtrace_open): Treat EACCESS like ENOENT. + +2020-05-12 H.J. Lu <hongjiu.lu@intel.com> * Makefile.am (AM_CFLAGS): Add $(CET_HOST_FLAGS). * configure.ac: Add GCC_CET_HOST_FLAGS(CET_HOST_FLAGS) and diff --git a/libbacktrace/posix.c b/libbacktrace/posix.c index 356e72b..a2c88dd 100644 --- a/libbacktrace/posix.c +++ b/libbacktrace/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)); 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; else error_callback (data, filename, errno); |