mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	We accidentally haven't been using $TMUX to work out the session for a while
and in fact it is less useful that using the client ttyname. So don't bother and don't pass it from the client. If we need it in future it is in c->environ.
This commit is contained in:
		
							
								
								
									
										30
									
								
								tmux.c
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								tmux.c
									
									
									
									
									
								
							@@ -48,11 +48,8 @@ time_t		 start_time;
 | 
			
		||||
char		 socket_path[MAXPATHLEN];
 | 
			
		||||
int		 login_shell;
 | 
			
		||||
char		*environ_path;
 | 
			
		||||
pid_t		 environ_pid = -1;
 | 
			
		||||
int		 environ_session_id = -1;
 | 
			
		||||
 | 
			
		||||
__dead void	 usage(void);
 | 
			
		||||
void	 	 parseenvironment(void);
 | 
			
		||||
char 		*makesocketpath(const char *);
 | 
			
		||||
 | 
			
		||||
#ifndef HAVE___PROGNAME
 | 
			
		||||
@@ -127,23 +124,6 @@ areshell(const char *shell)
 | 
			
		||||
	return (0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
parseenvironment(void)
 | 
			
		||||
{
 | 
			
		||||
	char	*env, path[256];
 | 
			
		||||
	long	 pid;
 | 
			
		||||
	int	 id;
 | 
			
		||||
 | 
			
		||||
	if ((env = getenv("TMUX")) == NULL)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	if (sscanf(env, "%255[^,],%ld,%d", path, &pid, &id) != 3)
 | 
			
		||||
		return;
 | 
			
		||||
	environ_path = xstrdup(path);
 | 
			
		||||
	environ_pid = pid;
 | 
			
		||||
	environ_session_id = id;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
char *
 | 
			
		||||
makesocketpath(const char *label)
 | 
			
		||||
{
 | 
			
		||||
@@ -226,7 +206,9 @@ main(int argc, char **argv)
 | 
			
		||||
{
 | 
			
		||||
	struct passwd	*pw;
 | 
			
		||||
	char		*s, *path, *label, *home, **var, tmp[MAXPATHLEN];
 | 
			
		||||
	int	 	 opt, flags, quiet, keys;
 | 
			
		||||
	char		 in[256];
 | 
			
		||||
	long long	 pid;
 | 
			
		||||
	int	 	 opt, flags, quiet, keys, session;
 | 
			
		||||
 | 
			
		||||
#if defined(DEBUG) && defined(__OpenBSD__)
 | 
			
		||||
	malloc_options = (char *) "AFGJPX";
 | 
			
		||||
@@ -357,11 +339,15 @@ main(int argc, char **argv)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Get path from environment. */
 | 
			
		||||
	s = getenv("TMUX");
 | 
			
		||||
	if (s != NULL && sscanf(s, "%255[^,],%lld,%d", in, &pid, &session) == 3)
 | 
			
		||||
		environ_path = xstrdup(in);
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Figure out the socket path. If specified on the command-line with -S
 | 
			
		||||
	 * or -L, use it, otherwise try $TMUX or assume -L default.
 | 
			
		||||
	 */
 | 
			
		||||
	parseenvironment();
 | 
			
		||||
	if (path == NULL) {
 | 
			
		||||
		/* If no -L, use the environment. */
 | 
			
		||||
		if (label == NULL) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user