summaryrefslogtreecommitdiffstats
path: root/tmux.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2012-11-27 18:12:04 +0000
committerThomas Adam <thomas@xteddy.org>2012-11-27 18:12:04 +0000
commit39631edb98a542be53fce6f1eeef41880c9a76b4 (patch)
treec25708a37d4c79d1dbbc89a91d34296df689d934 /tmux.c
parent1bc910a963ab3c39a03ed3e6b4795c6b5d5b6d18 (diff)
parent9b8998aeec9c4dff695ae4108965677d90d9c9c7 (diff)
Merge branch 'obsd-master'
Sync from OpenBSD.
Diffstat (limited to 'tmux.c')
-rw-r--r--tmux.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tmux.c b/tmux.c
index 5a773f6d..4b58abad 100644
--- a/tmux.c
+++ b/tmux.c
@@ -162,7 +162,7 @@ parseenvironment(void)
char *
makesocketpath(const char *label)
{
- char base[MAXPATHLEN], *path, *s;
+ char base[MAXPATHLEN], realbase[MAXPATHLEN], *path, *s;
struct stat sb;
u_int uid;
@@ -186,7 +186,10 @@ makesocketpath(const char *label)
return (NULL);
}
- xasprintf(&path, "%s/%s", base, label);
+ if (realpath(base, realbase) == NULL)
+ strlcpy(realbase, base, sizeof realbase);
+
+ xasprintf(&path, "%s/%s", realbase, label);
return (path);
}
@@ -333,6 +336,8 @@ main(int argc, char **argv)
options_init(&global_w_options, NULL);
options_table_populate_tree(window_options_table, &global_w_options);
+ ARRAY_INIT(&cfg_causes);
+
/* Enable UTF-8 if the first client is on UTF-8 terminal. */
if (flags & IDENTIFY_UTF8) {
options_set_number(&global_s_options, "status-utf8", 1);
@@ -390,8 +395,7 @@ main(int argc, char **argv)
}
}
free(label);
- if (realpath(path, socket_path) == NULL)
- strlcpy(socket_path, path, sizeof socket_path);
+ strlcpy(socket_path, path, sizeof socket_path);
free(path);
#ifdef HAVE_SETPROCTITLE