summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/tmux.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2013-03-27 11:24:18 +0000
committernicm <nicm@openbsd.org>2013-03-27 11:24:18 +0000
commit40b64c4112b26486ce77e4a02f4b24b5c562936e (patch)
tree0586462258ac7de48f8a59a640ed092187b4f80e /usr.bin/tmux/tmux.c
parentMove the cursor back into the last column on CUU/CUD to match xterm (diff)
downloadwireguard-openbsd-40b64c4112b26486ce77e4a02f4b24b5c562936e.tar.xz
wireguard-openbsd-40b64c4112b26486ce77e4a02f4b24b5c562936e.zip
Add TMUX_TMPDIR variable to put the socket directory outside
TMPDIR. From Ben Boeckel.
Diffstat (limited to 'usr.bin/tmux/tmux.c')
-rw-r--r--usr.bin/tmux/tmux.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c
index 0a908d083f0..94c1f3cdaa7 100644
--- a/usr.bin/tmux/tmux.c
+++ b/usr.bin/tmux/tmux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.c,v 1.117 2013/03/27 11:17:12 nicm Exp $ */
+/* $OpenBSD: tmux.c,v 1.118 2013/03/27 11:24:18 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -164,10 +164,12 @@ makesocketpath(const char *label)
u_int uid;
uid = getuid();
- if ((s = getenv("TMPDIR")) == NULL || *s == '\0')
- xsnprintf(base, sizeof base, "%s/tmux-%u", _PATH_TMP, uid);
- else
+ if ((s = getenv("TMUX_TMPDIR")) != NULL && *s != '\0')
+ xsnprintf(base, sizeof base, "%s/", s);
+ else if ((s = getenv("TMPDIR")) != NULL && *s != '\0')
xsnprintf(base, sizeof base, "%s/tmux-%u", s, uid);
+ else
+ xsnprintf(base, sizeof base, "%s/tmux-%u", _PATH_TMP, uid);
if (mkdir(base, S_IRWXU) != 0 && errno != EEXIST)
return (NULL);