public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* libgo patch committed: Don't stat a NULL filename
@ 2018-06-28 22:53 Ian Lance Taylor
  0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2018-06-28 22:53 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 361 bytes --]

The libgo code to create a backtrace state would sometimes call
stat(NULL).  This didn't matter, since the stat failure would not
cause any further problem, but it was pointless and sloppy.  The
problem was pointed out by Andreas Schwab in PR 86331.  This patch
removes it.  Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.
Committed to mainline.

Ian

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1020 bytes --]

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 262120)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@
-baaaf1e0f1e9a54ea2dfe475154c85c83ec03740
+e1fcce0aec27b1f50ac0e736f39f4c806c2a5baa
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/runtime/go-caller.c
===================================================================
--- libgo/runtime/go-caller.c	(revision 261819)
+++ libgo/runtime/go-caller.c	(working copy)
@@ -116,7 +116,7 @@ __go_get_backtrace_state ()
 	 argv[0] (http://gcc.gnu.org/PR61895).  It would be nice to
 	 have a better check for whether this file is the real
 	 executable.  */
-      if (stat (filename, &s) < 0 || s.st_size < 1024)
+      if (filename != NULL && (stat (filename, &s) < 0 || s.st_size < 1024))
 	filename = NULL;
 
       back_state = backtrace_create_state (filename, 1, error_callback, NULL);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-06-28 20:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-28 22:53 libgo patch committed: Don't stat a NULL filename Ian Lance Taylor

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).