From: Ville Syrjälä Date: Sat, 11 Apr 2020 21:08:52 +0000 (+0300) Subject: [PATCH] fix realpath vs. firefox X-Git-Tag: archive/raspbian/2.4.101-2+rpi1^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=dd543153bababb199b1506cbdc9926dba06edf68;p=libdrm.git [PATCH] fix realpath vs. firefox Gbp-Pq: Name fix-realpath-vs-firefox.diff --- 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);