mirror of
				https://github.com/tiagovignatti/intel-gpu-tools.git
				synced 2025-11-03 19:47:15 +00:00 
			
		
		
		
	igt/drm_read: Clear O_NONBLOCK between tests
Ensure that O_NONBLOCK isn't accidentally set when we want a nonblocking file descroptor. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
		
							parent
							
								
									32329b2e7d
								
							
						
					
					
						commit
						e10ba6b51c
					
				@ -80,20 +80,21 @@ static void wait_for_event(int fd)
 | 
			
		||||
static int setup(int in, int nonblock)
 | 
			
		||||
{
 | 
			
		||||
	int fd;
 | 
			
		||||
	int ret = -1;
 | 
			
		||||
 | 
			
		||||
	alarm(0);
 | 
			
		||||
 | 
			
		||||
	fd = dup(in);
 | 
			
		||||
	if (nonblock) {
 | 
			
		||||
		int ret = -1;
 | 
			
		||||
		if (fd != -1)
 | 
			
		||||
			ret = fcntl(fd, F_GETFL);
 | 
			
		||||
		if (ret != -1) {
 | 
			
		||||
	if (fd != -1)
 | 
			
		||||
		ret = fcntl(fd, F_GETFL);
 | 
			
		||||
	if (ret != -1) {
 | 
			
		||||
		if (nonblock)
 | 
			
		||||
			ret |= O_NONBLOCK;
 | 
			
		||||
			ret = fcntl(fd, F_SETFL, ret);
 | 
			
		||||
		}
 | 
			
		||||
		igt_require(ret != -1);
 | 
			
		||||
		else
 | 
			
		||||
			ret &= ~O_NONBLOCK;
 | 
			
		||||
		ret = fcntl(fd, F_SETFL, ret);
 | 
			
		||||
	}
 | 
			
		||||
	igt_require(ret != -1);
 | 
			
		||||
 | 
			
		||||
	assert_empty(fd);
 | 
			
		||||
	return fd;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user