mirror of
				https://gitlab.freedesktop.org/wayland/wayland.git
				synced 2025-11-03 09:01:42 -05:00 
			
		
		
		
	server: Create the socket FD after taking the lock
We're going to split out the lock-taking to another function so we can repetitively try locks.
This commit is contained in:
		
							parent
							
								
									68dd7d1f5f
								
							
						
					
					
						commit
						6e8a662403
					
				
					 1 changed files with 6 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -1083,12 +1083,6 @@ wl_display_add_socket(struct wl_display *display, const char *name)
 | 
			
		|||
	if (s == NULL)
 | 
			
		||||
		return -1;
 | 
			
		||||
 | 
			
		||||
	s->fd = wl_os_socket_cloexec(PF_LOCAL, SOCK_STREAM, 0);
 | 
			
		||||
	if (s->fd < 0) {
 | 
			
		||||
		wl_socket_destroy(s);
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (name == NULL)
 | 
			
		||||
		name = getenv("WAYLAND_DISPLAY");
 | 
			
		||||
	if (name == NULL)
 | 
			
		||||
| 
						 | 
				
			
			@ -1115,6 +1109,12 @@ wl_display_add_socket(struct wl_display *display, const char *name)
 | 
			
		|||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	s->fd = wl_os_socket_cloexec(PF_LOCAL, SOCK_STREAM, 0);
 | 
			
		||||
	if (s->fd < 0) {
 | 
			
		||||
		wl_socket_destroy(s);
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	size = offsetof (struct sockaddr_un, sun_path) + name_size;
 | 
			
		||||
	if (bind(s->fd, (struct sockaddr *) &s->addr, size) < 0) {
 | 
			
		||||
		wl_log("bind() failed with error: %m\n");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue