mirror of
https://github.com/tmate-io/tmate.git
synced 2025-03-31 10:56:21 +02:00
Sync OpenBSD patchset 838:
Use TMPDIR if set, from Han Boetes.
This commit is contained in:
parent
6c3186a19a
commit
57eb948c48
7
tmux.1
7
tmux.1
@ -1,4 +1,4 @@
|
|||||||
.\" $Id: tmux.1,v 1.292 2011-01-21 23:45:34 tcunha Exp $
|
.\" $Id: tmux.1,v 1.293 2011-01-21 23:46:50 tcunha Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
.\"
|
.\"
|
||||||
@ -134,7 +134,10 @@ will report an error and exit without executing further commands.
|
|||||||
.It Fl L Ar socket-name
|
.It Fl L Ar socket-name
|
||||||
.Nm
|
.Nm
|
||||||
stores the server socket in a directory under
|
stores the server socket in a directory under
|
||||||
.Pa /tmp ;
|
.Pa /tmp
|
||||||
|
(or
|
||||||
|
.Ev TMPDIR
|
||||||
|
if set);
|
||||||
the default socket is named
|
the default socket is named
|
||||||
.Em default .
|
.Em default .
|
||||||
This option allows a different socket name to be specified, allowing several
|
This option allows a different socket name to be specified, allowing several
|
||||||
|
9
tmux.c
9
tmux.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tmux.c,v 1.234 2011-01-21 23:44:13 tcunha Exp $ */
|
/* $Id: tmux.c,v 1.235 2011-01-21 23:46:50 tcunha Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -172,12 +172,15 @@ parseenvironment(void)
|
|||||||
char *
|
char *
|
||||||
makesocketpath(const char *label)
|
makesocketpath(const char *label)
|
||||||
{
|
{
|
||||||
char base[MAXPATHLEN], *path;
|
char base[MAXPATHLEN], *path, *s;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
u_int uid;
|
u_int uid;
|
||||||
|
|
||||||
uid = getuid();
|
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)
|
if (mkdir(base, S_IRWXU) != 0 && errno != EEXIST)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user