mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Use TMPDIR if set, from Han Boetes.
This commit is contained in:
		
							
								
								
									
										5
									
								
								tmux.1
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								tmux.1
									
									
									
									
									
								
							@@ -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
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										7
									
								
								tmux.c
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								tmux.c
									
									
									
									
									
								
							@@ -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);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user