mirror of
https://github.com/tmux/tmux.git
synced 2025-11-01 15:06:06 +00:00
Merge branch 'obsd-master'
This commit is contained in:
@@ -135,16 +135,7 @@ cmd_source_file_done(struct client *c, const char *path, int error,
|
|||||||
static void
|
static void
|
||||||
cmd_source_file_add(struct cmd_source_file_data *cdata, const char *path)
|
cmd_source_file_add(struct cmd_source_file_data *cdata, const char *path)
|
||||||
{
|
{
|
||||||
char resolved[PATH_MAX];
|
|
||||||
|
|
||||||
if (realpath(path, resolved) == NULL) {
|
|
||||||
log_debug("%s: realpath(\"%s\") failed: %s", __func__,
|
|
||||||
path, strerror(errno));
|
|
||||||
} else
|
|
||||||
path = resolved;
|
|
||||||
|
|
||||||
log_debug("%s: %s", __func__, path);
|
log_debug("%s: %s", __func__, path);
|
||||||
|
|
||||||
cdata->files = xreallocarray(cdata->files, cdata->nfiles + 1,
|
cdata->files = xreallocarray(cdata->files, cdata->nfiles + 1,
|
||||||
sizeof *cdata->files);
|
sizeof *cdata->files);
|
||||||
cdata->files[cdata->nfiles++] = xstrdup(path);
|
cdata->files[cdata->nfiles++] = xstrdup(path);
|
||||||
|
|||||||
16
tmux.c
16
tmux.c
@@ -139,7 +139,7 @@ expand_path(const char *path, const char *home)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
expand_paths(const char *s, char ***paths, u_int *n, int ignore_errors)
|
expand_paths(const char *s, char ***paths, u_int *n, int no_realpath)
|
||||||
{
|
{
|
||||||
const char *home = find_home();
|
const char *home = find_home();
|
||||||
char *copy, *next, *tmp, resolved[PATH_MAX], *expanded;
|
char *copy, *next, *tmp, resolved[PATH_MAX], *expanded;
|
||||||
@@ -156,15 +156,15 @@ expand_paths(const char *s, char ***paths, u_int *n, int ignore_errors)
|
|||||||
log_debug("%s: invalid path: %s", __func__, next);
|
log_debug("%s: invalid path: %s", __func__, next);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (realpath(expanded, resolved) == NULL) {
|
if (no_realpath)
|
||||||
log_debug("%s: realpath(\"%s\") failed: %s", __func__,
|
path = expanded;
|
||||||
expanded, strerror(errno));
|
else {
|
||||||
if (ignore_errors) {
|
if (realpath(expanded, resolved) == NULL) {
|
||||||
|
log_debug("%s: realpath(\"%s\") failed: %s", __func__,
|
||||||
|
expanded, strerror(errno));
|
||||||
free(expanded);
|
free(expanded);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
path = expanded;
|
|
||||||
} else {
|
|
||||||
path = xstrdup(resolved);
|
path = xstrdup(resolved);
|
||||||
free(expanded);
|
free(expanded);
|
||||||
}
|
}
|
||||||
@@ -196,7 +196,7 @@ make_label(const char *label, char **cause)
|
|||||||
label = "default";
|
label = "default";
|
||||||
uid = getuid();
|
uid = getuid();
|
||||||
|
|
||||||
expand_paths(TMUX_SOCK, &paths, &n, 1);
|
expand_paths(TMUX_SOCK, &paths, &n, 0);
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
xasprintf(cause, "no suitable socket path");
|
xasprintf(cause, "no suitable socket path");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user