Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] Pass --data-directory through gdb_realpath.
Date: Tue, 15 Apr 2014 17:37:00 -0000	[thread overview]
Message-ID: <yjt2wqeqxzn3.fsf@ruffy.mtv.corp.google.com> (raw)

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


             reply	other threads:[~2014-04-15 17:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-15 17:37 Doug Evans [this message]
2014-04-15 23:35 ` Doug Evans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yjt2wqeqxzn3.fsf@ruffy.mtv.corp.google.com \
    --to=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox