[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
This commit is contained in:
Sergio Durigan Junior
2021-09-25 17:27:23 -04:00
parent e4860c08f9
commit 906e2b7664

View File

@@ -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);
}