From 5df2b34d2b8cf99a19a81a43d2fea9dac65ed122 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Mon, 19 Aug 2024 14:59:44 +0200 Subject: [PATCH] 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. --- render/allocator/gbm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/render/allocator/gbm.c b/render/allocator/gbm.c index 2e609b7a..da035c66 100644 --- a/render/allocator/gbm.c +++ b/render/allocator/gbm.c @@ -96,6 +96,7 @@ static struct wlr_gbm_buffer *create_buffer(struct wlr_gbm_allocator *alloc, bool has_modifier = true; uint64_t fallback_modifier = DRM_FORMAT_MOD_INVALID; + errno = 0; struct gbm_bo *bo = gbm_bo_create_with_modifiers(gbm_device, width, height, format->format, format->modifiers, format->len); 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"); return NULL; } + errno = 0; bo = gbm_bo_create(gbm_device, width, height, format->format, usage); has_modifier = false; }