mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	When started as the shell, __progname contains a leading -, so hardcode "tmux"
for socket path and log files, and strip it when working out the shell.
This commit is contained in:
		
							
								
								
									
										5
									
								
								tmux.c
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								tmux.c
									
									
									
									
									
								
							@@ -79,8 +79,7 @@ logfile(const char *name)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	log_close();
 | 
						log_close();
 | 
				
			||||||
	if (debug_level > 0) {
 | 
						if (debug_level > 0) {
 | 
				
			||||||
		xasprintf(
 | 
							xasprintf(&path, "tmux-%s-%ld.log", name, (long) getpid());
 | 
				
			||||||
		    &path, "%s-%s-%ld.log", __progname, name, (long) getpid());
 | 
					 | 
				
			||||||
		log_open_file(debug_level, path);
 | 
							log_open_file(debug_level, path);
 | 
				
			||||||
		xfree(path);
 | 
							xfree(path);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -184,7 +183,7 @@ makesockpath(const char *label)
 | 
				
			|||||||
	u_int		uid;
 | 
						u_int		uid;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	uid = getuid();
 | 
						uid = getuid();
 | 
				
			||||||
	xsnprintf(base, MAXPATHLEN, "%s/%s-%d", _PATH_TMP, __progname, uid);
 | 
						xsnprintf(base, MAXPATHLEN, "%s/tmux-%d", _PATH_TMP, uid);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (mkdir(base, S_IRWXU) != 0 && errno != EEXIST)
 | 
						if (mkdir(base, S_IRWXU) != 0 && errno != EEXIST)
 | 
				
			||||||
		return (NULL);
 | 
							return (NULL);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										6
									
								
								window.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								window.c
									
									
									
									
									
								
							@@ -62,6 +62,7 @@ const char *
 | 
				
			|||||||
window_default_command(void)
 | 
					window_default_command(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	const char	*shell, *ptr;
 | 
						const char	*shell, *ptr;
 | 
				
			||||||
 | 
						char		*progname;
 | 
				
			||||||
	struct passwd	*pw;
 | 
						struct passwd	*pw;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	shell = getenv("SHELL");
 | 
						shell = getenv("SHELL");
 | 
				
			||||||
@@ -81,7 +82,10 @@ found:
 | 
				
			|||||||
		ptr++;
 | 
							ptr++;
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		ptr = shell;
 | 
							ptr = shell;
 | 
				
			||||||
	if (strcmp(ptr, __progname) == 0)
 | 
						progname = __progname;
 | 
				
			||||||
 | 
						if (*progname == '-')
 | 
				
			||||||
 | 
							progname++;
 | 
				
			||||||
 | 
						if (strcmp(ptr, progname) == 0)
 | 
				
			||||||
		return (_PATH_BSHELL);
 | 
							return (_PATH_BSHELL);
 | 
				
			||||||
	return (shell);
 | 
						return (shell);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user