mirror of
https://github.com/tmux/tmux.git
synced 2025-01-12 03:08:46 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
0610f66fa9
@ -309,6 +309,13 @@ cmd_set_option_set(struct cmd *self, struct cmdq_item *item, struct options *oo,
|
|||||||
old = xstrdup(options_get_string(oo, oe->name));
|
old = xstrdup(options_get_string(oo, oe->name));
|
||||||
options_set_string(oo, oe->name, append, "%s", value);
|
options_set_string(oo, oe->name, append, "%s", value);
|
||||||
new = options_get_string(oo, oe->name);
|
new = options_get_string(oo, oe->name);
|
||||||
|
if (strcmp(oe->name, "default-shell") == 0 &&
|
||||||
|
!checkshell(new)) {
|
||||||
|
options_set_string(oo, oe->name, 0, "%s", old);
|
||||||
|
free(old);
|
||||||
|
cmdq_error(item, "not a suitable shell: %s", value);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
if (oe->pattern != NULL && fnmatch(oe->pattern, new, 0) != 0) {
|
if (oe->pattern != NULL && fnmatch(oe->pattern, new, 0) != 0) {
|
||||||
options_set_string(oo, oe->name, 0, "%s", old);
|
options_set_string(oo, oe->name, 0, "%s", old);
|
||||||
free(old);
|
free(old);
|
||||||
|
@ -398,6 +398,8 @@ server_client_exec(struct client *c, const char *cmd)
|
|||||||
shell = options_get_string(s->options, "default-shell");
|
shell = options_get_string(s->options, "default-shell");
|
||||||
else
|
else
|
||||||
shell = options_get_string(global_s_options, "default-shell");
|
shell = options_get_string(global_s_options, "default-shell");
|
||||||
|
if (!checkshell(shell))
|
||||||
|
shell = _PATH_BSHELL;
|
||||||
shellsize = strlen(shell) + 1;
|
shellsize = strlen(shell) + 1;
|
||||||
|
|
||||||
msg = xmalloc(cmdsize + shellsize);
|
msg = xmalloc(cmdsize + shellsize);
|
||||||
@ -2011,7 +2013,7 @@ server_client_dispatch_shell(struct client *c)
|
|||||||
const char *shell;
|
const char *shell;
|
||||||
|
|
||||||
shell = options_get_string(global_s_options, "default-shell");
|
shell = options_get_string(global_s_options, "default-shell");
|
||||||
if (*shell == '\0' || areshell(shell))
|
if (!checkshell(shell))
|
||||||
shell = _PATH_BSHELL;
|
shell = _PATH_BSHELL;
|
||||||
proc_send(c->peer, MSG_SHELL, -1, shell, strlen(shell) + 1);
|
proc_send(c->peer, MSG_SHELL, -1, shell, strlen(shell) + 1);
|
||||||
|
|
||||||
|
2
spawn.c
2
spawn.c
@ -318,7 +318,7 @@ spawn_pane(struct spawn_context *sc, char **cause)
|
|||||||
/* Then the shell. If respawning, use the old one. */
|
/* Then the shell. If respawning, use the old one. */
|
||||||
if (~sc->flags & SPAWN_RESPAWN) {
|
if (~sc->flags & SPAWN_RESPAWN) {
|
||||||
tmp = options_get_string(s->options, "default-shell");
|
tmp = options_get_string(s->options, "default-shell");
|
||||||
if (*tmp == '\0' || areshell(tmp))
|
if (!checkshell(tmp))
|
||||||
tmp = _PATH_BSHELL;
|
tmp = _PATH_BSHELL;
|
||||||
free(new_wp->shell);
|
free(new_wp->shell);
|
||||||
new_wp->shell = xstrdup(tmp);
|
new_wp->shell = xstrdup(tmp);
|
||||||
|
6
tmux.c
6
tmux.c
@ -46,8 +46,8 @@ const char *shell_command;
|
|||||||
static __dead void usage(void);
|
static __dead void usage(void);
|
||||||
static char *make_label(const char *, char **);
|
static char *make_label(const char *, char **);
|
||||||
|
|
||||||
|
static int areshell(const char *);
|
||||||
static const char *getshell(void);
|
static const char *getshell(void);
|
||||||
static int checkshell(const char *);
|
|
||||||
|
|
||||||
static __dead void
|
static __dead void
|
||||||
usage(void)
|
usage(void)
|
||||||
@ -76,7 +76,7 @@ getshell(void)
|
|||||||
return (_PATH_BSHELL);
|
return (_PATH_BSHELL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
int
|
||||||
checkshell(const char *shell)
|
checkshell(const char *shell)
|
||||||
{
|
{
|
||||||
if (shell == NULL || *shell != '/')
|
if (shell == NULL || *shell != '/')
|
||||||
@ -88,7 +88,7 @@ checkshell(const char *shell)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
areshell(const char *shell)
|
areshell(const char *shell)
|
||||||
{
|
{
|
||||||
const char *progname, *ptr;
|
const char *progname, *ptr;
|
||||||
|
2
tmux.h
2
tmux.h
@ -1773,7 +1773,7 @@ extern const char *socket_path;
|
|||||||
extern const char *shell_command;
|
extern const char *shell_command;
|
||||||
extern int ptm_fd;
|
extern int ptm_fd;
|
||||||
extern const char *shell_command;
|
extern const char *shell_command;
|
||||||
int areshell(const char *);
|
int checkshell(const char *);
|
||||||
void setblocking(int, int);
|
void setblocking(int, int);
|
||||||
const char *find_cwd(void);
|
const char *find_cwd(void);
|
||||||
const char *find_home(void);
|
const char *find_home(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user