]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libbacktrace: treat EACCESS like ENOENT
authorIan Lance Taylor <iant@golang.org>
Wed, 13 May 2020 17:18:45 +0000 (10:18 -0700)
committerIan Lance Taylor <iant@golang.org>
Wed, 13 May 2020 17:19:58 +0000 (10:19 -0700)
libbacktrace/
PR go/95061
* posix.c (backtrace_open): Treat EACCESS like ENOENT.

libbacktrace/ChangeLog
libbacktrace/posix.c

index 9668906d20fc90279ed640726f5ba3e939ebbaa9..89b690d415e9da603edb0630086612a517661244 100644 (file)
@@ -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
index 356e72b4a3bffedee628ce57a93e729c007caf87..a2c88dd8e4ad3c0e7409ada5d0f233815cc372cd 100644 (file)
@@ -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);