diff options
author | Thomas Adam <thomas@xteddy.org> | 2012-11-27 18:12:04 +0000 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2012-11-27 18:12:04 +0000 |
commit | 39631edb98a542be53fce6f1eeef41880c9a76b4 (patch) | |
tree | c25708a37d4c79d1dbbc89a91d34296df689d934 /tmux.c | |
parent | 1bc910a963ab3c39a03ed3e6b4795c6b5d5b6d18 (diff) | |
parent | 9b8998aeec9c4dff695ae4108965677d90d9c9c7 (diff) | |
download | rtmux-39631edb98a542be53fce6f1eeef41880c9a76b4.tar.gz rtmux-39631edb98a542be53fce6f1eeef41880c9a76b4.tar.bz2 rtmux-39631edb98a542be53fce6f1eeef41880c9a76b4.zip |
Merge branch 'obsd-master'
Sync from OpenBSD.
Diffstat (limited to 'tmux.c')
-rw-r--r-- | tmux.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -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 |