From 471d63ac170e2a2c6dcfb3656aa7d1e9a4b2029c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= Date: Sun, 12 Apr 2020 00:08:52 +0300 Subject: [PATCH] fix realpath vs. firefox --- xf86drm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xf86drm.c b/xf86drm.c index d240f95b6d08..76e415c72de4 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -3011,9 +3011,11 @@ static int drmParseSubsystemType(int maj, int min) snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device", maj, min); if (!realpath(path, real_path)) return -errno; - snprintf(path, sizeof(path), "%s", real_path); - - subsystem_type = get_subsystem_type(path); + subsystem_type = get_subsystem_type(real_path); + if (subsystem_type >= 0) + memcpy(path, real_path, sizeof(path)); + else + subsystem_type = get_subsystem_type(path); if (subsystem_type == DRM_BUS_VIRTIO) { strncat(path, "/..", PATH_MAX); subsystem_type = get_subsystem_type(path); -- 2.24.1