mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-01 22:58:38 -04:00
backend/drm: use wlr_drm_backend.name for fd cloning
This also fixes a memleak.
(cherry picked from commit 92ff86db23)
This commit is contained in:
parent
e3760fb1b7
commit
fc8fd786c0
1 changed files with 1 additions and 7 deletions
|
|
@ -1806,16 +1806,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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue