From 906e2b7664c5becfa3e10717a7d530e87fdab4ec Mon Sep 17 00:00:00 2001 From: Sergio Durigan Junior Date: Sat, 25 Sep 2021 17:27:23 -0400 Subject: [PATCH] [PR gdb/28369] Use get_shell on gdb/ser-pipe.c PR gdb/28369 reports that gdb/ser-pipe.c has an 'execl' function call with a hard-coded "/bin/sh" as its argument. We've had 'get_shell' for a while now, which is conscious about the SHELL environment and a better alternative to always calling "/bin/sh". Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28369 --- gdb/ser-pipe.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gdb/ser-pipe.c b/gdb/ser-pipe.c index cc72010ae46..257e0d4a107 100644 --- a/gdb/ser-pipe.c +++ b/gdb/ser-pipe.c @@ -30,6 +30,7 @@ #include "gdbsupport/gdb_sys_time.h" #include #include "gdbsupport/filestuff.h" +#include "gdbsupport/pathstuff.h" #include @@ -122,7 +123,9 @@ pipe_open (struct serial *scb, const char *name) } close_most_fds (); - execl ("/bin/sh", "sh", "-c", name, (char *) 0); + + const char *shellfile = get_shell (); + execl (shellfile, shellfile, "-c", name, (char *) 0); _exit (127); } -- 2.30.2