mirror of
https://github.com/tmux/tmux.git
synced 2025-09-01 20:57:00 +00:00
show-* and set-* need to handle a missing target.
This commit is contained in:
@ -47,7 +47,7 @@ cmd_set_environment_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct environ *env;
|
||||
const char *name, *value;
|
||||
const char *name, *value, *target;
|
||||
|
||||
name = args->argv[0];
|
||||
if (*name == '\0') {
|
||||
@ -64,10 +64,19 @@ cmd_set_environment_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
else
|
||||
value = args->argv[1];
|
||||
|
||||
if (args_has(self->args, 'g') || cmdq->state.tflag.s == NULL)
|
||||
if (args_has(self->args, 'g'))
|
||||
env = global_environ;
|
||||
else
|
||||
else {
|
||||
if (cmdq->state.tflag.s == NULL) {
|
||||
target = args_get(args, 't');
|
||||
if (target != NULL)
|
||||
cmdq_error(cmdq, "no such session: %s", target);
|
||||
else
|
||||
cmdq_error(cmdq, "no current session");
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
env = cmdq->state.tflag.s->environ;
|
||||
}
|
||||
|
||||
if (args_has(self->args, 'u')) {
|
||||
if (value != NULL) {
|
||||
|
Reference in New Issue
Block a user