mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Read the path from $TMUX if it is present and -L and -S are not given. Based on
a diff from Micah Cowan.
This commit is contained in:
		
							
								
								
									
										29
									
								
								tmux.c
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								tmux.c
									
									
									
									
									
								
							@@ -443,13 +443,30 @@ main(int argc, char **argv)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (label == NULL)
 | 
			
		||||
		label = xstrdup("default");
 | 
			
		||||
	if (path == NULL && (path = makesockpath(label)) == NULL) {
 | 
			
		||||
		log_warn("can't create socket");
 | 
			
		||||
		exit(1);
 | 
			
		||||
	/*
 | 
			
		||||
	 * Figure out the socket path. If specified on the command-line with
 | 
			
		||||
	 * -S or -L, use it, otherwise try $TMUX or assume -L default.
 | 
			
		||||
	 */
 | 
			
		||||
	if (path == NULL) {
 | 
			
		||||
		/* No -L. Try $TMUX, or default. */
 | 
			
		||||
		if (label == NULL) {
 | 
			
		||||
			if ((path = getenv("TMUX")) != NULL) {
 | 
			
		||||
				path = xstrdup(path);
 | 
			
		||||
				path[strcspn(path, ",")] = '\0';
 | 
			
		||||
			} else
 | 
			
		||||
				label = xstrdup("default");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* -L or default set. */
 | 
			
		||||
		if (label != NULL) {
 | 
			
		||||
			if ((path = makesockpath(label)) == NULL) {
 | 
			
		||||
				log_warn("can't create socket");
 | 
			
		||||
				exit(1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	xfree(label);
 | 
			
		||||
	if (label != NULL)
 | 
			
		||||
		xfree(label);
 | 
			
		||||
 | 
			
		||||
	if (shellcmd != NULL) {
 | 
			
		||||
		msg = MSG_SHELL;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user