aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Primak <vyivel@eclair.cafe>2024-01-31 11:04:14 +0300
committerKirill Primak <vyivel@eclair.cafe>2024-01-31 11:10:55 +0300
commit92ff86db234faae32707fc102a90aa51f8676203 (patch)
tree429d50bdc55ed534ade54679ea414d7d9fabe274
parent8dff1bb9bdbb2d785ddb5d330934166d359b3d78 (diff)
backend/drm: use wlr_drm_backend.name for fd cloning
This also fixes a memleak.
-rw-r--r--backend/drm/drm.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index b2bebe2d..b4d8a069 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -1820,16 +1820,10 @@ int wlr_drm_backend_get_non_master_fd(struct wlr_backend *backend) {
assert(backend);
struct wlr_drm_backend *drm = get_drm_backend_from_backend(backend);
- char *path = drmGetDeviceNameFromFd2(drm->fd);
- if (!path) {
- wlr_log(WLR_ERROR, "Failed to get device name from DRM fd");
- return -1;
- }
+ int fd = open(drm->name, O_RDWR | O_CLOEXEC);
- int fd = open(path, O_RDWR | O_CLOEXEC);
if (fd < 0) {
wlr_log_errno(WLR_ERROR, "Unable to clone DRM fd for client fd");
- free(path);
return -1;
}