[RFC 1/6] Unify shell-finding logic

Simon Marchi simon.marchi@polymtl.ca
Fri Sep 28 21:39:00 GMT 2018


On 2018-09-26 07:11, Tom Tromey wrote:
> diff --git a/gdb/procfs.c b/gdb/procfs.c
> index 6ffe569e69..ca381a71ae 100644
> --- a/gdb/procfs.c
> +++ b/gdb/procfs.c
> @@ -3035,11 +3035,11 @@ procfs_target::create_inferior (const char 
> *exec_file,
>  				const std::string &allargs,
>  				char **env, int from_tty)
>  {
> -  char *shell_file = getenv ("SHELL");
> +  const char *shell_file = get_shell ();
>    char *tryname;
>    int pid;
> 
> -  if (shell_file != NULL && strchr (shell_file, '/') == NULL)
> +  if (strchr (shell_file, '/') == NULL)

At first I thought this would change the behavior here, but I think it's 
fine.  If SHELL is not defined, we used to pass NULL to fork_inferior, 
and it would fall back to /bin/sh.  Now, the fallback just happens 
sooner.  So this looks good, I think this patch can go in by itself.

Thanks,

Simon



More information about the Gdb-patches mailing list