aboutsummaryrefslogtreecommitdiff
path: root/gdb/ser-pipe.c
diff options
context:
space:
mode:
authorSergio Durigan Junior <sergiodj@sergiodj.net>2021-09-25 17:27:23 -0400
committerSergio Durigan Junior <sergiodj@sergiodj.net>2021-09-30 18:19:10 -0400
commit906e2b7664c5becfa3e10717a7d530e87fdab4ec (patch)
tree24d35fbeb7356183990284daa497056ffcd0b144 /gdb/ser-pipe.c
parente4860c08f990675c9b3535ab18cc7ff21e2a5639 (diff)
downloadgdb-906e2b7664c5becfa3e10717a7d530e87fdab4ec.zip
gdb-906e2b7664c5becfa3e10717a7d530e87fdab4ec.tar.gz
gdb-906e2b7664c5becfa3e10717a7d530e87fdab4ec.tar.bz2
[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
Diffstat (limited to 'gdb/ser-pipe.c')
-rw-r--r--gdb/ser-pipe.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gdb/ser-pipe.c b/gdb/ser-pipe.c
index cc72010..257e0d4 100644
--- a/gdb/ser-pipe.c
+++ b/gdb/ser-pipe.c
@@ -30,6 +30,7 @@
#include "gdbsupport/gdb_sys_time.h"
#include <fcntl.h>
#include "gdbsupport/filestuff.h"
+#include "gdbsupport/pathstuff.h"
#include <signal.h>
@@ -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);
}