mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Work around Linux realpath breakage.
This commit is contained in:
		
							
								
								
									
										17
									
								
								tmux.c
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								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>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -219,8 +219,19 @@ main(int argc, char **argv)
 | 
				
			|||||||
		    "%s/%s-%lu", _PATH_TMP, __progname, (u_long) getuid());
 | 
							    "%s/%s-%lu", _PATH_TMP, __progname, (u_long) getuid());
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (realpath(path, rpath) == NULL) {
 | 
						if (realpath(path, rpath) == NULL) {
 | 
				
			||||||
		log_warn("%s", path);
 | 
							if (errno != ENOENT) {
 | 
				
			||||||
		exit(1);
 | 
								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);
 | 
						xfree(path);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user