Rémi Bernon : winebus.sys: Only read EVIOCGID result if the ioctl succeeded.

Alexandre Julliard julliard at winehq.org
Mon Aug 16 18:07:25 CDT 2021


Module: wine
Branch: master
Commit: aa40700f9f46d7e04a6263582718669c5d0f5639
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=aa40700f9f46d7e04a6263582718669c5d0f5639

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Mon Aug 16 08:56:22 2021 +0200

winebus.sys: Only read EVIOCGID result if the ioctl succeeded.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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
 




More information about the wine-cvs mailing list