From dd543153bababb199b1506cbdc9926dba06edf68 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ville=20Syrj=C3=A4l=C3=A4?= Date: Sun, 12 Apr 2020 00:08:52 +0300 Subject: [PATCH] [PATCH] fix realpath vs. firefox Gbp-Pq: Name fix-realpath-vs-firefox.diff --- xf86drm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xf86drm.c b/xf86drm.c index d240f95..76e415c 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.30.2