mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Work around Linux realpath breakage.
This commit is contained in:
		
							
								
								
									
										13
									
								
								tmux.c
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								tmux.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: tmux.c,v 1.41 2007-11-16 21:12:31 nicm Exp $ */
 | 
			
		||||
/* $Id: tmux.c,v 1.42 2007-11-20 12:59:27 nicm Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -219,9 +219,20 @@ main(int argc, char **argv)
 | 
			
		||||
		    "%s/%s-%lu", _PATH_TMP, __progname, (u_long) getuid());
 | 
			
		||||
	}
 | 
			
		||||
	if (realpath(path, rpath) == NULL) {
 | 
			
		||||
		if (errno != ENOENT) {
 | 
			
		||||
			log_warn("%s", path);
 | 
			
		||||
			exit(1);
 | 
			
		||||
		}
 | 
			
		||||
		/*
 | 
			
		||||
		 * Linux appears to fill in the buffer fine but then returns
 | 
			
		||||
		 * ENOENT if the file doesn't exist. But since it returns an
 | 
			
		||||
		 * error, we can't rely on the buffer. Grr.
 | 
			
		||||
		 */
 | 
			
		||||
		if (strlcpy(rpath, path, sizeof rpath) >= sizeof rpath) {
 | 
			
		||||
			log_warnx("%s: %s", path, strerror(ENAMETOOLONG));
 | 
			
		||||
			exit(1);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	xfree(path);
 | 
			
		||||
 | 
			
		||||
	shell = getenv("SHELL");
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user