mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Userspace doesn't need to use SUN_LEN(): connect() and bind() must accept
sizeof(struct sockaddr_un), so do the simple, portable thing ok beck@ deraadt@
This commit is contained in:
		
							
								
								
									
										2
									
								
								client.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								client.c
									
									
									
									
									
								
							@@ -119,7 +119,7 @@ retry:
 | 
				
			|||||||
		fatal("socket failed");
 | 
							fatal("socket failed");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	log_debug("trying connect");
 | 
						log_debug("trying connect");
 | 
				
			||||||
	if (connect(fd, (struct sockaddr *) &sa, SUN_LEN(&sa)) == -1) {
 | 
						if (connect(fd, (struct sockaddr *) &sa, sizeof(sa)) == -1) {
 | 
				
			||||||
		log_debug("connect failed: %s", strerror(errno));
 | 
							log_debug("connect failed: %s", strerror(errno));
 | 
				
			||||||
		if (errno != ECONNREFUSED && errno != ENOENT)
 | 
							if (errno != ECONNREFUSED && errno != ENOENT)
 | 
				
			||||||
			goto failed;
 | 
								goto failed;
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								server.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								server.c
									
									
									
									
									
								
							@@ -145,7 +145,7 @@ server_create_socket(void)
 | 
				
			|||||||
		return (-1);
 | 
							return (-1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	mask = umask(S_IXUSR|S_IXGRP|S_IRWXO);
 | 
						mask = umask(S_IXUSR|S_IXGRP|S_IRWXO);
 | 
				
			||||||
	if (bind(fd, (struct sockaddr *) &sa, SUN_LEN(&sa)) == -1)
 | 
						if (bind(fd, (struct sockaddr *) &sa, sizeof(sa)) == -1)
 | 
				
			||||||
		return (-1);
 | 
							return (-1);
 | 
				
			||||||
	umask(mask);
 | 
						umask(mask);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user