Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Pass --data-directory through gdb_realpath.
@ 2014-04-15 17:37 Doug Evans
  2014-04-15 23:35 ` Doug Evans
  0 siblings, 1 reply; 2+ messages in thread
From: Doug Evans @ 2014-04-15 17:37 UTC (permalink / raw)
  To: gdb-patches

Hi.

gdb currently records the supplied --data-directory as is,
which if a relative path will be wrong if the user cd's
to a different directory.

2014-04-15  Doug Evans  <dje@google.com>

	* main.c (captured_main): Pass --data-directory through gdb_realpath.

diff --git a/gdb/main.c b/gdb/main.c
index 59015f5..d269638 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -642,7 +642,15 @@ captured_main (void *data)
 	    break;
 	  case 'D':
 	    xfree (gdb_datadir);
-	    gdb_datadir = xstrdup (optarg);
+	    if (optarg[0] == '\0')
+	      {
+		fprintf_unfiltered (gdb_stderr,
+				    _("%s: empty path for"
+				      " `--data-directory'\n"),
+				    argv[0]);
+		exit (1);
+	      }
+	    gdb_datadir = gdb_realpath (optarg);
 	    gdb_datadir_provided = 1;
 	    break;
 #ifdef GDBTK


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-15 23:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-15 17:37 [PATCH] Pass --data-directory through gdb_realpath Doug Evans
2014-04-15 23:35 ` Doug Evans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox