This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v3 1/2] Create new common/pathstuff.[ch]


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]