mirror of
				https://github.com/tiagovignatti/intel-gpu-tools.git
				synced 2025-11-04 03:58:27 +00:00 
			
		
		
		
	overlay: Close DRI2 device after authentication failure
So that we don't leave a master fd open when operating remotely. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
		
							parent
							
								
									92a2f8010b
								
							
						
					
					
						commit
						163b6a52a4
					
				@ -39,6 +39,7 @@
 | 
			
		||||
#include <xf86drm.h>
 | 
			
		||||
#include <drm.h>
 | 
			
		||||
#include <fcntl.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
 | 
			
		||||
#include "dri2.h"
 | 
			
		||||
 | 
			
		||||
@ -160,10 +161,14 @@ int dri2_open(Display *dpy)
 | 
			
		||||
		return -1;
 | 
			
		||||
 | 
			
		||||
	if (drmIoctl(fd, DRM_IOCTL_GET_MAGIC, &auth))
 | 
			
		||||
		return -1;
 | 
			
		||||
		goto err_fd;
 | 
			
		||||
 | 
			
		||||
	if (!DRI2Authenticate(dpy, DefaultRootWindow(dpy), auth.magic))
 | 
			
		||||
		return -1;
 | 
			
		||||
		goto err_fd;
 | 
			
		||||
 | 
			
		||||
	return fd;
 | 
			
		||||
 | 
			
		||||
err_fd:
 | 
			
		||||
	close(fd);
 | 
			
		||||
	return -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user