diff options
-rw-r--r-- | usr.bin/tmux/tmux.1 | 9 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.c | 9 |
2 files changed, 12 insertions, 6 deletions
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index fa30e5f5572..552f2cc4740 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.207 2011/01/09 18:46:46 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.208 2011/01/12 22:23:58 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: January 9 2011 $ +.Dd $Mdocdate: January 12 2011 $ .Dt TMUX 1 .Os .Sh NAME @@ -134,7 +134,10 @@ will report an error and exit without executing further commands. .It Fl L Ar socket-name .Nm stores the server socket in a directory under -.Pa /tmp ; +.Pa /tmp +(or +.Ev TMPDIR +if set); the default socket is named .Em default . This option allows a different socket name to be specified, allowing several diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c index 5c994dfdd47..a6a0a972f84 100644 --- a/usr.bin/tmux/tmux.c +++ b/usr.bin/tmux/tmux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.c,v 1.101 2011/01/08 01:52:37 nicm Exp $ */ +/* $OpenBSD: tmux.c,v 1.102 2011/01/12 22:23:58 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -169,12 +169,15 @@ parseenvironment(void) char * makesocketpath(const char *label) { - char base[MAXPATHLEN], *path; + char base[MAXPATHLEN], *path, *s; struct stat sb; u_int uid; uid = getuid(); - xsnprintf(base, MAXPATHLEN, "%s/tmux-%d", _PATH_TMP, uid); + if ((s = getenv("TMPDIR")) == NULL || *s == '\0') + xsnprintf(base, sizeof base, "%s/tmux-%u", _PATH_TMP, uid); + else + xsnprintf(base, sizeof base, "%s/tmux-%u", s, uid); if (mkdir(base, S_IRWXU) != 0 && errno != EEXIST) return (NULL); |