diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2011-01-12 22:23:58 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2011-01-12 22:23:58 +0000 |
commit | b3438c86bfb69bfdda55e15525abcacd33738686 (patch) | |
tree | 761213d7f4cb2b2fea4f7f6d465dccab42fd1b9e /tmux.c | |
parent | 47e18f4ceacc4c207dc0d392f51d55b2286672f2 (diff) | |
download | rtmux-b3438c86bfb69bfdda55e15525abcacd33738686.tar.gz rtmux-b3438c86bfb69bfdda55e15525abcacd33738686.tar.bz2 rtmux-b3438c86bfb69bfdda55e15525abcacd33738686.zip |
Use TMPDIR if set, from Han Boetes.
Diffstat (limited to 'tmux.c')
-rw-r--r-- | tmux.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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); |