mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 16:28:48 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
d8398af770
@ -120,7 +120,8 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
cdata->cmd_else = NULL;
|
cdata->cmd_else = NULL;
|
||||||
|
|
||||||
cdata->client = item->client;
|
cdata->client = item->client;
|
||||||
cdata->client->references++;
|
if (cdata->client != NULL)
|
||||||
|
cdata->client->references++;
|
||||||
|
|
||||||
if (!args_has(args, 'b'))
|
if (!args_has(args, 'b'))
|
||||||
cdata->item = item;
|
cdata->item = item;
|
||||||
@ -193,7 +194,8 @@ cmd_if_shell_free(void *data)
|
|||||||
{
|
{
|
||||||
struct cmd_if_shell_data *cdata = data;
|
struct cmd_if_shell_data *cdata = data;
|
||||||
|
|
||||||
server_client_unref(cdata->client);
|
if (cdata->client != NULL)
|
||||||
|
server_client_unref(cdata->client);
|
||||||
|
|
||||||
free(cdata->cmd_else);
|
free(cdata->cmd_else);
|
||||||
free(cdata->cmd_if);
|
free(cdata->cmd_if);
|
||||||
|
@ -127,6 +127,7 @@ error:
|
|||||||
free(pdata);
|
free(pdata);
|
||||||
if (f != NULL)
|
if (f != NULL)
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
free(file);
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,6 +111,7 @@ cmd_save_buffer_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
if (fwrite(bufdata, 1, bufsize, f) != bufsize) {
|
if (fwrite(bufdata, 1, bufsize, f) != bufsize) {
|
||||||
cmdq_error(item, "%s: write error", file);
|
cmdq_error(item, "%s: write error", file);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
free(file);
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,8 @@ cmd_set_option_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
enum options_table_scope scope;
|
enum options_table_scope scope;
|
||||||
struct options *oo;
|
struct options *oo;
|
||||||
struct options_entry *parent, *o;
|
struct options_entry *parent, *o;
|
||||||
const char *name, *value, *target;
|
char *name;
|
||||||
|
const char *value, *target;
|
||||||
int window, idx, already, error, ambiguous;
|
int window, idx, already, error, ambiguous;
|
||||||
char *cause;
|
char *cause;
|
||||||
|
|
||||||
@ -121,7 +122,7 @@ cmd_set_option_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
return (CMD_RETURN_NORMAL);
|
return (CMD_RETURN_NORMAL);
|
||||||
cmdq_error(item, "%s", cause);
|
cmdq_error(item, "%s", cause);
|
||||||
free(cause);
|
free(cause);
|
||||||
return (CMD_RETURN_ERROR);
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Which table should this option go into? */
|
/* Which table should this option go into? */
|
||||||
@ -136,7 +137,7 @@ cmd_set_option_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
cmdq_error(item, "no such session: %s", target);
|
cmdq_error(item, "no such session: %s", target);
|
||||||
else
|
else
|
||||||
cmdq_error(item, "no current session");
|
cmdq_error(item, "no current session");
|
||||||
return (CMD_RETURN_ERROR);
|
goto fail;
|
||||||
} else
|
} else
|
||||||
oo = s->options;
|
oo = s->options;
|
||||||
} else if (scope == OPTIONS_TABLE_WINDOW) {
|
} else if (scope == OPTIONS_TABLE_WINDOW) {
|
||||||
@ -148,7 +149,7 @@ cmd_set_option_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
cmdq_error(item, "no such window: %s", target);
|
cmdq_error(item, "no such window: %s", target);
|
||||||
else
|
else
|
||||||
cmdq_error(item, "no current window");
|
cmdq_error(item, "no current window");
|
||||||
return (CMD_RETURN_ERROR);
|
goto fail;
|
||||||
} else
|
} else
|
||||||
oo = wl->window->options;
|
oo = wl->window->options;
|
||||||
}
|
}
|
||||||
@ -159,7 +160,7 @@ cmd_set_option_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
if (idx != -1) {
|
if (idx != -1) {
|
||||||
if (*name == '@' || options_array_size(parent, NULL) == -1) {
|
if (*name == '@' || options_array_size(parent, NULL) == -1) {
|
||||||
cmdq_error(item, "not an array: %s", args->argv[0]);
|
cmdq_error(item, "not an array: %s", args->argv[0]);
|
||||||
return (CMD_RETURN_ERROR);
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,14 +178,14 @@ cmd_set_option_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
if (args_has(args, 'q'))
|
if (args_has(args, 'q'))
|
||||||
return (CMD_RETURN_NORMAL);
|
return (CMD_RETURN_NORMAL);
|
||||||
cmdq_error(item, "already set: %s", args->argv[0]);
|
cmdq_error(item, "already set: %s", args->argv[0]);
|
||||||
return (CMD_RETURN_ERROR);
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Change the option. */
|
/* Change the option. */
|
||||||
if (args_has(args, 'u')) {
|
if (args_has(args, 'u')) {
|
||||||
if (o == NULL)
|
if (o == NULL)
|
||||||
return (CMD_RETURN_NORMAL);
|
goto fail;
|
||||||
if (idx == -1) {
|
if (idx == -1) {
|
||||||
if (oo == global_options ||
|
if (oo == global_options ||
|
||||||
oo == global_s_options ||
|
oo == global_s_options ||
|
||||||
@ -197,17 +198,17 @@ cmd_set_option_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
} else if (*name == '@') {
|
} else if (*name == '@') {
|
||||||
if (value == NULL) {
|
if (value == NULL) {
|
||||||
cmdq_error(item, "empty value");
|
cmdq_error(item, "empty value");
|
||||||
return (CMD_RETURN_ERROR);
|
goto fail;
|
||||||
}
|
}
|
||||||
options_set_string(oo, name, append, "%s", value);
|
options_set_string(oo, name, append, "%s", value);
|
||||||
} else if (idx == -1 && options_array_size(parent, NULL) == -1) {
|
} else if (idx == -1 && options_array_size(parent, NULL) == -1) {
|
||||||
error = cmd_set_option_set(self, item, oo, parent, value);
|
error = cmd_set_option_set(self, item, oo, parent, value);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (CMD_RETURN_ERROR);
|
goto fail;
|
||||||
} else {
|
} else {
|
||||||
if (value == NULL) {
|
if (value == NULL) {
|
||||||
cmdq_error(item, "empty value");
|
cmdq_error(item, "empty value");
|
||||||
return (CMD_RETURN_ERROR);
|
goto fail;
|
||||||
}
|
}
|
||||||
if (o == NULL)
|
if (o == NULL)
|
||||||
o = options_empty(oo, options_table_entry(parent));
|
o = options_empty(oo, options_table_entry(parent));
|
||||||
@ -217,7 +218,7 @@ cmd_set_option_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
options_array_assign(o, value);
|
options_array_assign(o, value);
|
||||||
} else if (options_array_set(o, idx, value, append) != 0) {
|
} else if (options_array_set(o, idx, value, append) != 0) {
|
||||||
cmdq_error(item, "invalid index: %s", args->argv[0]);
|
cmdq_error(item, "invalid index: %s", args->argv[0]);
|
||||||
return (CMD_RETURN_ERROR);
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,7 +262,12 @@ cmd_set_option_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
server_redraw_client(c);
|
server_redraw_client(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(name);
|
||||||
return (CMD_RETURN_NORMAL);
|
return (CMD_RETURN_NORMAL);
|
||||||
|
|
||||||
|
fail:
|
||||||
|
free(name);
|
||||||
|
return (CMD_RETURN_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -433,7 +433,7 @@ options_match(const char *s, int *idx, int* ambiguous)
|
|||||||
|
|
||||||
if (*name == '@') {
|
if (*name == '@') {
|
||||||
*ambiguous = 0;
|
*ambiguous = 0;
|
||||||
return (xstrdup(name));
|
return (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
found = NULL;
|
found = NULL;
|
||||||
|
8
server.c
8
server.c
@ -118,12 +118,16 @@ server_create_socket(void)
|
|||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
mask = umask(S_IXUSR|S_IXGRP|S_IRWXO);
|
mask = umask(S_IXUSR|S_IXGRP|S_IRWXO);
|
||||||
if (bind(fd, (struct sockaddr *) &sa, sizeof(sa)) == -1)
|
if (bind(fd, (struct sockaddr *) &sa, sizeof(sa)) == -1) {
|
||||||
|
close(fd);
|
||||||
return (-1);
|
return (-1);
|
||||||
|
}
|
||||||
umask(mask);
|
umask(mask);
|
||||||
|
|
||||||
if (listen(fd, 128) == -1)
|
if (listen(fd, 128) == -1) {
|
||||||
|
close(fd);
|
||||||
return (-1);
|
return (-1);
|
||||||
|
}
|
||||||
setblocking(fd, 0);
|
setblocking(fd, 0);
|
||||||
|
|
||||||
return (fd);
|
return (fd);
|
||||||
|
Loading…
Reference in New Issue
Block a user