Use _PATH_BSHELL to ensure using a bourne shell

[Michael]
This commit should fix problems with people using a non-bourne shell as
login shell, e.g. fish or rc. AFAICT, $SHELL should only be used for
interactive shells, but we just want a bourne shell, not an interactive
shell.
This commit is contained in:
Baptiste Daroussin
2013-11-08 21:13:35 +01:00
committed by Michael Stapelberg
parent 857fc0bf17
commit f691a55923
3 changed files with 6 additions and 23 deletions

View File

@ -22,6 +22,7 @@
#include <getopt.h>
#include <limits.h>
#include <fcntl.h>
#include <paths.h>
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
@ -95,15 +96,8 @@ static void start_application(const char *command) {
/* Child process */
setsid();
if (fork() == 0) {
/* Stores the path of the shell */
static const char *shell = NULL;
if (shell == NULL)
if ((shell = getenv("SHELL")) == NULL)
shell = "/bin/sh";
/* This is the child */
execl(shell, shell, "-c", command, (void*)NULL);
execl(_PATH_BSHELL, _PATH_BSHELL, "-c", command, (void*)NULL);
/* not reached */
}
exit(0);