From d762ced298c35d58524433cacb08c5d0a7364f96 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 26 Nov 2012 11:35:28 +0000 Subject: Call realpath earlier on the socket directory path rather than on the socket file path because the latter may not exist yet and in that case realpath is allowed to fail. From Romain Francoise. --- tmux.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tmux.c') diff --git a/tmux.c b/tmux.c index e01017c9..7bce10ec 100644 --- a/tmux.c +++ b/tmux.c @@ -159,7 +159,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; @@ -183,7 +183,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); } @@ -384,8 +387,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); /* Set process title. */ -- cgit v1.2.3 From 9b8998aeec9c4dff695ae4108965677d90d9c9c7 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 27 Nov 2012 16:12:29 +0000 Subject: Correctly aggregate together errors from nested config files (with source-file). Fix by Thomas Adam, reported by Sam Livingstone-Gray --- tmux.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tmux.c') diff --git a/tmux.c b/tmux.c index 7bce10ec..2428a404 100644 --- a/tmux.c +++ b/tmux.c @@ -330,6 +330,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); -- cgit v1.2.3