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:
parent
857fc0bf17
commit
f691a55923
|
@ -22,6 +22,7 @@
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <paths.h>
|
||||||
|
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
#include <xcb/xcb_aux.h>
|
#include <xcb/xcb_aux.h>
|
||||||
|
@ -95,15 +96,8 @@ static void start_application(const char *command) {
|
||||||
/* Child process */
|
/* Child process */
|
||||||
setsid();
|
setsid();
|
||||||
if (fork() == 0) {
|
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 */
|
/* This is the child */
|
||||||
execl(shell, shell, "-c", command, (void*)NULL);
|
execl(_PATH_BSHELL, _PATH_BSHELL, "-c", command, (void*)NULL);
|
||||||
/* not reached */
|
/* not reached */
|
||||||
}
|
}
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <yajl/yajl_parse.h>
|
#include <yajl/yajl_parse.h>
|
||||||
#include <yajl/yajl_version.h>
|
#include <yajl/yajl_version.h>
|
||||||
#include <yajl/yajl_gen.h>
|
#include <yajl/yajl_gen.h>
|
||||||
|
#include <paths.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
@ -423,12 +424,7 @@ void start_child(char *command) {
|
||||||
dup2(pipe_in[1], STDOUT_FILENO);
|
dup2(pipe_in[1], STDOUT_FILENO);
|
||||||
dup2(pipe_out[0], STDIN_FILENO);
|
dup2(pipe_out[0], STDIN_FILENO);
|
||||||
|
|
||||||
static const char *shell = NULL;
|
execl(_PATH_BSHELL, _PATH_BSHELL, "-c", command, (char*) NULL);
|
||||||
|
|
||||||
if ((shell = getenv("SHELL")) == NULL)
|
|
||||||
shell = "/bin/sh";
|
|
||||||
|
|
||||||
execl(shell, shell, "-c", command, (char*) NULL);
|
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
/* Parent-process. Reroute streams */
|
/* Parent-process. Reroute streams */
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
#include <paths.h>
|
||||||
|
|
||||||
#define SN_API_NOT_YET_FROZEN 1
|
#define SN_API_NOT_YET_FROZEN 1
|
||||||
#include <libsn/sn-launcher.h>
|
#include <libsn/sn-launcher.h>
|
||||||
|
@ -191,15 +192,7 @@ void start_application(const char *command, bool no_startup_id) {
|
||||||
if (!no_startup_id)
|
if (!no_startup_id)
|
||||||
sn_launcher_context_setup_child_process(context);
|
sn_launcher_context_setup_child_process(context);
|
||||||
|
|
||||||
/* Stores the path of the shell */
|
execl(_PATH_BSHELL, _PATH_BSHELL, "-c", command, (void*)NULL);
|
||||||
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);
|
|
||||||
/* not reached */
|
/* not reached */
|
||||||
}
|
}
|
||||||
_exit(0);
|
_exit(0);
|
||||||
|
|
Loading…
Reference in New Issue