diff options
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/tmux.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c index 7b436227319..2e39e6bfa14 100644 --- a/usr.bin/tmux/tmux.c +++ b/usr.bin/tmux/tmux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.c,v 1.112 2012/07/10 11:53:01 nicm Exp $ */ +/* $OpenBSD: tmux.c,v 1.113 2012/11/26 11:35:28 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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. */ |