From 0cd18d0dfb360b0bf2f822d8e5458f6db92f6916 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Wed, 19 Jun 2024 13:48:57 +0200 Subject: [PATCH] OpenBSD: fix FTBS on misspelled and missing variables ../xf86drm.c:4622:9: error: use of undeclared identifier 'written'; did you mean 'write'? if (written + 1 > max_node_length) ^~~~~~~ write ../xf86drm.c:4624:21: error: use of undeclared identifier 'sbuf'; did you mean 'sbrk'? if (stat(node, &sbuf)) ^~~~ Signed-off-by: Enrico Weigelt, metux IT consult --- xf86drm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xf86drm.c b/xf86drm.c index eff4150d..5f0eddc4 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -4595,6 +4595,7 @@ drm_public int drmGetDeviceFromDevId(dev_t find_rdev, uint32_t flags, drmDeviceP int node_type, subsystem_type; int maj, min, n, ret; const int max_node_length = ALIGN(drmGetMaxNodeName(), sizeof(void *)); + struct stat sbuf; if (device == NULL) return -EINVAL; @@ -4619,8 +4620,8 @@ drm_public int drmGetDeviceFromDevId(dev_t find_rdev, uint32_t flags, drmDeviceP n = snprintf(node, PATH_MAX, dev_name, DRM_DIR_NAME, min); if (n == -1 || n >= PATH_MAX) return -errno; - if (written + 1 > max_node_length) - return -EINVAL + if (n + 1 > max_node_length) + return -EINVAL; if (stat(node, &sbuf)) return -EINVAL;