]> granicus.if.org Git - strace/commitdiff
evdev.c: fix decoding of struct input_id
authorDmitry V. Levin <ldv@altlinux.org>
Fri, 27 May 2016 00:41:43 +0000 (00:41 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sat, 28 May 2016 00:56:47 +0000 (00:56 +0000)
* evdev.c (getid_ioctl): Use umove_or_printaddr.

evdev.c

diff --git a/evdev.c b/evdev.c
index 1ffad841d7c17ed01d23f4cdf5c6a14fc34b844e..f86416bb1b049391f7624d21d302130caf2e100f 100644 (file)
--- a/evdev.c
+++ b/evdev.c
@@ -232,19 +232,20 @@ keycode_V2_ioctl(struct tcb *tcp, long arg)
 static int
 getid_ioctl(struct tcb *tcp, long arg)
 {
+       tprints(", ");
+
        struct input_id id;
 
-       if (!verbose(tcp) || umove(tcp, arg, &id) < 0)
-               return 0;
+       if (!umove_or_printaddr(tcp, arg, &id))
+               tprintf("{ID_BUS=%" PRIu16
+                       ", ID_VENDOR=%" PRIu16
+                       ", ID_PRODUCT=%" PRIu16
+                       ", ID_VERSION=%" PRIu16 "}",
+                       id.bustype,
+                       id.vendor,
+                       id.product,
+                       id.version);
 
-       tprintf(", {ID_BUS=%" PRIu16 ", ID_VENDOR=%" PRIu16,
-               id.bustype, id.vendor);
-       if (!abbrev(tcp)) {
-               tprintf(", ID_PRODUCT=%" PRIu16 ", ID_VERSION=%" PRIu16 "}",
-                       id.product, id.version);
-       } else {
-               tprints(", ...}");
-       }
        return 1;
 }