mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:44:18 +00:00 
			
		
		
		
	If realpath() fails just try the original path.
This commit is contained in:
		@@ -81,8 +81,9 @@ cmd_load_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
 | 
			
		||||
		file = xstrdup(path);
 | 
			
		||||
	else
 | 
			
		||||
		xasprintf(&file, "%s/%s", cwd, path);
 | 
			
		||||
	if (realpath(file, resolved) == NULL) {
 | 
			
		||||
		cmdq_error(cmdq, "%s: %s", file, strerror(errno));
 | 
			
		||||
	if (realpath(file, resolved) == NULL &&
 | 
			
		||||
	    strlcpy(resolved, file, sizeof resolved) >= sizeof resolved) {
 | 
			
		||||
		cmdq_error(cmdq, "%s: %s", file, strerror(ENAMETOOLONG));
 | 
			
		||||
		return (CMD_RETURN_ERROR);
 | 
			
		||||
	}
 | 
			
		||||
	f = fopen(resolved, "rb");
 | 
			
		||||
 
 | 
			
		||||
@@ -107,8 +107,9 @@ cmd_save_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
 | 
			
		||||
		file = xstrdup(path);
 | 
			
		||||
	else
 | 
			
		||||
		xasprintf(&file, "%s/%s", cwd, path);
 | 
			
		||||
	if (realpath(file, resolved) == NULL)  {
 | 
			
		||||
		cmdq_error(cmdq, "%s: %s", file, strerror(errno));
 | 
			
		||||
	if (realpath(file, resolved) == NULL &&
 | 
			
		||||
	    strlcpy(resolved, file, sizeof resolved) >= sizeof resolved) {
 | 
			
		||||
		cmdq_error(cmdq, "%s: %s", file, strerror(ENAMETOOLONG));
 | 
			
		||||
		return (CMD_RETURN_ERROR);
 | 
			
		||||
	}
 | 
			
		||||
	f = fopen(resolved, flags);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user