diff options
author | Tom Tromey <tom@tromey.com> | 2018-09-14 10:35:45 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-10-27 11:58:40 -0600 |
commit | 974e68446388769f023c6c9bfb1e67ed75199618 (patch) | |
tree | 49cb772e05b3d9157addbfea699624a0f293e969 /gdb/windows-nat.c | |
parent | c8ee3f04a66141d5fa930cd77bc53ac0bc17de32 (diff) | |
download | gdb-974e68446388769f023c6c9bfb1e67ed75199618.zip gdb-974e68446388769f023c6c9bfb1e67ed75199618.tar.gz gdb-974e68446388769f023c6c9bfb1e67ed75199618.tar.bz2 |
Unify shell-finding logic
I noticed several places in gdb that were using getenv("SHELL") and
then falling back to "/bin/sh" if it returned NULL. This unifies
these into a single function.
gdb/ChangeLog
2018-10-27 Tom Tromey <tom@tromey.com>
* procfs.c (procfs_target::create_inferior): Use get_shell.
* cli/cli-cmds.c (shell_escape): Use get_shell.
* windows-nat.c (windows_nat_target::create_inferior): Use
get_shell.
* common/pathstuff.c (get_shell): New function.
* nat/fork-inferior.c (SHELL_FILE, get_startup_shell): Remove.
(fork_inferior): Use get_shell.
* common/pathstuff.h (get_shell): Declare.
Diffstat (limited to 'gdb/windows-nat.c')
-rw-r--r-- | gdb/windows-nat.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 0047a26..8292cf4 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -68,6 +68,7 @@ #include "complaints.h" #include "inf-child.h" #include "gdb_tilde_expand.h" +#include "common/pathstuff.h" #define AdjustTokenPrivileges dyn_AdjustTokenPrivileges #define DebugActiveProcessStop dyn_DebugActiveProcessStop @@ -2578,9 +2579,7 @@ windows_nat_target::create_inferior (const char *exec_file, } else { - sh = getenv ("SHELL"); - if (!sh) - sh = "/bin/sh"; + sh = get_shell (); if (cygwin_conv_path (CCP_POSIX_TO_WIN_W, sh, shell, __PMAX) < 0) error (_("Error starting executable via shell: %d"), errno); #ifdef __USEWIDE |