mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Make a tmux-%u directory under TMUX_TMPDIR, like TMPDIR.
This commit is contained in:
		
							
								
								
									
										5
									
								
								tmux.c
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								tmux.c
									
									
									
									
									
								
							@@ -131,7 +131,7 @@ makesocketpath(const char *label)
 | 
			
		||||
 | 
			
		||||
	uid = getuid();
 | 
			
		||||
	if ((s = getenv("TMUX_TMPDIR")) != NULL && *s != '\0')
 | 
			
		||||
		xsnprintf(base, sizeof base, "%s/", s);
 | 
			
		||||
		xsnprintf(base, sizeof base, "%s/tmux-%u", s, uid);
 | 
			
		||||
	else if ((s = getenv("TMPDIR")) != NULL && *s != '\0')
 | 
			
		||||
		xsnprintf(base, sizeof base, "%s/tmux-%u", s, uid);
 | 
			
		||||
	else
 | 
			
		||||
@@ -146,8 +146,7 @@ makesocketpath(const char *label)
 | 
			
		||||
		errno = ENOTDIR;
 | 
			
		||||
		return (NULL);
 | 
			
		||||
	}
 | 
			
		||||
	if (sb.st_uid != uid || (!S_ISDIR(sb.st_mode) &&
 | 
			
		||||
		sb.st_mode & (S_IRWXG|S_IRWXO)) != 0) {
 | 
			
		||||
	if (sb.st_uid != uid || (sb.st_mode & S_IRWXO) != 0) {
 | 
			
		||||
		errno = EACCES;
 | 
			
		||||
		return (NULL);
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user