From: Dmitry V. Levin Date: Fri, 27 May 2016 00:42:18 +0000 (+0000) Subject: evdev.c: fix decoding of EVIOCGNAME, EVIOCGPHYS, and EVIOCGUNIQ X-Git-Tag: v4.12~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=10de2eb030ed48036eba638d9477a3151df232d0;p=strace evdev.c: fix decoding of EVIOCGNAME, EVIOCGPHYS, and EVIOCGUNIQ * evdev.c (evdev_read_ioctl): Fix printing of the string returned in response to EVIOCGNAME, EVIOCGPHYS, and EVIOCGUNIQ requests. --- diff --git a/evdev.c b/evdev.c index b889bb99..2d10d8b2 100644 --- 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)):