diff options
author | Tiago Cunha <tcunha@gmx.com> | 2011-01-21 23:46:50 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2011-01-21 23:46:50 +0000 |
commit | 57eb948c480da7bb7b54680786521e41baecb2fe (patch) | |
tree | 6356ae557ccb1d22b52124e3747a2d49c03e8a1f /tmux.c | |
parent | 6c3186a19aff18c715a9491e487dec5dc71d50b8 (diff) | |
download | rtmux-57eb948c480da7bb7b54680786521e41baecb2fe.tar.gz rtmux-57eb948c480da7bb7b54680786521e41baecb2fe.tar.bz2 rtmux-57eb948c480da7bb7b54680786521e41baecb2fe.zip |
Sync OpenBSD patchset 838:
Use TMPDIR if set, from Han Boetes.
Diffstat (limited to 'tmux.c')
-rw-r--r-- | tmux.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -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> @@ -172,12 +172,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); |