mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	backend/session/logind: dup FD with CLOEXEC
This commit is contained in:
		
							parent
							
								
									41af8d8459
								
							
						
					
					
						commit
						22faddde9e
					
				
					 1 changed files with 8 additions and 2 deletions
				
			
		| 
						 | 
					@ -294,7 +294,8 @@ error:
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int resume_device(sd_bus_message *msg, void *userdata, sd_bus_error *ret_error) {
 | 
					static int resume_device(sd_bus_message *msg, void *userdata,
 | 
				
			||||||
 | 
							sd_bus_error *ret_error) {
 | 
				
			||||||
	struct logind_session *session = userdata;
 | 
						struct logind_session *session = userdata;
 | 
				
			||||||
	int ret;
 | 
						int ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -309,7 +310,12 @@ static int resume_device(sd_bus_message *msg, void *userdata, sd_bus_error *ret_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (major == DRM_MAJOR) {
 | 
						if (major == DRM_MAJOR) {
 | 
				
			||||||
		struct wlr_device *dev = find_device(&session->base, makedev(major, minor));
 | 
							struct wlr_device *dev = find_device(&session->base, makedev(major, minor));
 | 
				
			||||||
		dup2(fd, dev->fd);
 | 
					
 | 
				
			||||||
 | 
							close(dev->fd);
 | 
				
			||||||
 | 
							if (fcntl(fd, F_DUPFD_CLOEXEC, dev->fd) < 0) {
 | 
				
			||||||
 | 
								wlr_log_errno(WLR_ERROR, "Failed to duplicate file descriptor");
 | 
				
			||||||
 | 
								goto error;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!session->base.active) {
 | 
							if (!session->base.active) {
 | 
				
			||||||
			session->base.active = true;
 | 
								session->base.active = true;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue