mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	allocator/gbm: Reset errno before gbm_bo_create
Not all paths in GBM set errno properly on error. Reset it to zero before calling GBM to avoid accidentally printing a garbage error.
This commit is contained in:
		
							parent
							
								
									ccd4703207
								
							
						
					
					
						commit
						5df2b34d2b
					
				
					 1 changed files with 2 additions and 0 deletions
				
			
		| 
						 | 
					@ -96,6 +96,7 @@ static struct wlr_gbm_buffer *create_buffer(struct wlr_gbm_allocator *alloc,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool has_modifier = true;
 | 
						bool has_modifier = true;
 | 
				
			||||||
	uint64_t fallback_modifier = DRM_FORMAT_MOD_INVALID;
 | 
						uint64_t fallback_modifier = DRM_FORMAT_MOD_INVALID;
 | 
				
			||||||
 | 
						errno = 0;
 | 
				
			||||||
	struct gbm_bo *bo = gbm_bo_create_with_modifiers(gbm_device, width, height,
 | 
						struct gbm_bo *bo = gbm_bo_create_with_modifiers(gbm_device, width, height,
 | 
				
			||||||
		format->format, format->modifiers, format->len);
 | 
							format->format, format->modifiers, format->len);
 | 
				
			||||||
	if (bo == NULL) {
 | 
						if (bo == NULL) {
 | 
				
			||||||
| 
						 | 
					@ -109,6 +110,7 @@ static struct wlr_gbm_buffer *create_buffer(struct wlr_gbm_allocator *alloc,
 | 
				
			||||||
			wlr_log_errno(WLR_ERROR, "gbm_bo_create_with_modifiers failed");
 | 
								wlr_log_errno(WLR_ERROR, "gbm_bo_create_with_modifiers failed");
 | 
				
			||||||
			return NULL;
 | 
								return NULL;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							errno = 0;
 | 
				
			||||||
		bo = gbm_bo_create(gbm_device, width, height, format->format, usage);
 | 
							bo = gbm_bo_create(gbm_device, width, height, format->format, usage);
 | 
				
			||||||
		has_modifier = false;
 | 
							has_modifier = false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue