mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Merge branch 'obsd-master'
This commit is contained in:
		
							
								
								
									
										28
									
								
								tmux.c
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								tmux.c
									
									
									
									
									
								
							@@ -200,10 +200,27 @@ shell_exec(const char *shell, const char *shellcmd)
 | 
			
		||||
	fatal("execl failed");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char*
 | 
			
		||||
find_home(void)
 | 
			
		||||
{
 | 
			
		||||
	struct passwd	*pw;
 | 
			
		||||
	const char	*home;
 | 
			
		||||
 | 
			
		||||
	home = getenv("HOME");
 | 
			
		||||
	if (home == NULL || *home == '\0') {
 | 
			
		||||
		pw = getpwuid(getuid());
 | 
			
		||||
		if (pw != NULL)
 | 
			
		||||
			home = pw->pw_dir;
 | 
			
		||||
		else
 | 
			
		||||
			home = NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return home;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
main(int argc, char **argv)
 | 
			
		||||
{
 | 
			
		||||
	struct passwd	*pw;
 | 
			
		||||
	char		*s, *path, *label, **var, tmp[PATH_MAX];
 | 
			
		||||
	char		 in[256];
 | 
			
		||||
	const char	*home;
 | 
			
		||||
@@ -325,14 +342,7 @@ main(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
	/* Locate the configuration file. */
 | 
			
		||||
	if (cfg_file == NULL) {
 | 
			
		||||
		home = getenv("HOME");
 | 
			
		||||
		if (home == NULL || *home == '\0') {
 | 
			
		||||
			pw = getpwuid(getuid());
 | 
			
		||||
			if (pw != NULL)
 | 
			
		||||
				home = pw->pw_dir;
 | 
			
		||||
			else
 | 
			
		||||
				home = NULL;
 | 
			
		||||
		}
 | 
			
		||||
		home = find_home();
 | 
			
		||||
		if (home != NULL) {
 | 
			
		||||
			xasprintf(&cfg_file, "%s/.tmux.conf", home);
 | 
			
		||||
			if (access(cfg_file, R_OK) != 0 && errno == ENOENT) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user