mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-03 16:46:18 +00:00 
			
		
		
		
	Don't leak dotfd if fchdir fails. From ettl dot martin78 at gmail dot com.
This commit is contained in:
		@@ -40,8 +40,12 @@ openat(int fd, const char *path, int flags, ...)
 | 
			
		||||
		dotfd = open(".", O_RDONLY);
 | 
			
		||||
		if (dotfd == -1)
 | 
			
		||||
			return (-1);
 | 
			
		||||
		if (fchdir(fd) != 0)
 | 
			
		||||
		if (fchdir(fd) != 0) {
 | 
			
		||||
			saved_errno = errno;
 | 
			
		||||
			close(dotfd);
 | 
			
		||||
			errno = saved_errno;
 | 
			
		||||
			return (-1);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	retval = open(path, flags, mode);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user