[PATCH 4/8] winebus.sys: Only read EVIOCGID result if the ioctl succeeded.

Rémi Bernon rbernon at codeweavers.com
Mon Aug 16 01:56:22 CDT 2021


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/winebus.sys/bus_udev.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c
index 5db1014c09f..174311b87ef 100644
--- a/dlls/winebus.sys/bus_udev.c
+++ b/dlls/winebus.sys/bus_udev.c
@@ -1135,13 +1135,16 @@ static void try_add_device(struct udev_device *dev)
 
         if (ioctl(fd, EVIOCGID, &device_id) < 0)
             WARN("ioctl(EVIOCGID) failed: %d %s\n", errno, strerror(errno));
+        else
+        {
+            vid = device_id.vendor;
+            pid = device_id.product;
+            version = device_id.version;
+        }
+
         device_uid[0] = 0;
         if (ioctl(fd, EVIOCGUNIQ(254), device_uid) >= 0 && device_uid[0])
             serial = strdupAtoW(device_uid);
-
-        vid = device_id.vendor;
-        pid = device_id.product;
-        version = device_id.version;
     }
 #endif
 
-- 
2.32.0




More information about the wine-devel mailing list