summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/tmux.111
-rw-r--r--usr.bin/tmux/tmux.c10
2 files changed, 12 insertions, 9 deletions
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index cf6dd8c96ad..7a028687c02 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.354 2013/03/27 11:17:12 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.355 2013/03/27 11:24:18 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
.\"
@@ -141,11 +141,12 @@ session created, and continues to process the rest of the configuration file.
.It Fl L Ar socket-name
.Nm
stores the server socket in a directory under
-.Pa /tmp
-(or
+.Ev TMUX_TMPDIR ,
.Ev TMPDIR
-if set);
-the default socket is named
+if it is unset, or
+.Pa /tmp
+if both are unset.
+The default socket is named
.Em default .
This option allows a different socket name to be specified, allowing several
independent
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);