This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v3 1/2] Create new common/pathstuff.[ch]
- From: Simon Marchi <simon dot marchi at ericsson dot com>
- To: Sergio Durigan Junior <sergiodj at redhat dot com>, GDB Patches <gdb-patches at sourceware dot org>
- Cc: Pedro Alves <palves at redhat dot com>, Joel Brobecker <brobecker at adacore dot com>
- Date: Wed, 28 Feb 2018 00:01:48 -0500
- Subject: Re: [PATCH v3 1/2] Create new common/pathstuff.[ch]
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=simon dot marchi at ericsson dot com;
- References: <20180210014241.19278-3-sergiodj@redhat.com> <20180228032708.19670-1-sergiodj@redhat.com> <20180228032708.19670-2-sergiodj@redhat.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On 2018-02-27 10:27 PM, Sergio Durigan Junior wrote:
> diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
> index cb02b58507..922d5269b3 100644
> --- a/gdb/gdbserver/server.c
> +++ b/gdb/gdbserver/server.c
> @@ -56,6 +56,10 @@
> break; \
> }
>
> +/* String containing the current directory (what getwd would return). */
> +
> +char *current_directory;
> +
> /* The environment to pass to the inferior when creating it. */
>
> static gdb_environ our_environ;
> @@ -3539,6 +3543,13 @@ captured_main (int argc, char *argv[])
> const char *selftest_filter = NULL;
> #endif
>
> + current_directory = getcwd (NULL, 0);
> + if (current_directory == NULL)
> + {
> + error (_("%s: error finding working directory"),
> + safe_strerror (errno));
> + }
Just one thing, I think Pedro suggested to put the variable string at the end:
error (_("Could not find working directory: %s"),
safe_strerror (errno));
Simon