]> granicus.if.org Git - strace/commitdiff
evdev.c: fix decoding of EVIOCGNAME, EVIOCGPHYS, and EVIOCGUNIQ
authorDmitry V. Levin <ldv@altlinux.org>
Fri, 27 May 2016 00:42:18 +0000 (00:42 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sat, 28 May 2016 00:56:47 +0000 (00:56 +0000)
* evdev.c (evdev_read_ioctl): Fix printing of the string returned
in response to EVIOCGNAME, EVIOCGPHYS, and EVIOCGUNIQ requests.

evdev.c

diff --git a/evdev.c b/evdev.c
index b889bb991c8017cc335c56b76c97c35e20ed73c4..2d10d8b29834d66abd363193e4c67cbe617cdca8 100644 (file)
--- a/evdev.c
+++ b/evdev.c
@@ -382,9 +382,6 @@ bit_ioctl(struct tcb *tcp, const unsigned int ev_nr, const long arg)
 static int
 evdev_read_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
 {
-       if (syserror(tcp))
-               return 0;
-
        /* fixed-number fixed-length commands */
        switch (code) {
                case EVIOCGVERSION:
@@ -419,7 +416,10 @@ evdev_read_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
                case _IOC_NR(EVIOCGPHYS(0)):
                case _IOC_NR(EVIOCGUNIQ(0)):
                        tprints(", ");
-                       printstr(tcp, arg, tcp->u_rval - 1);
+                       if (syserror(tcp))
+                               printaddr(arg);
+                       else
+                               printstr(tcp, arg, tcp->u_rval);
                        return 1;
 # ifdef EVIOCGPROP
                case _IOC_NR(EVIOCGPROP(0)):