From owner-svn-src-user@FreeBSD.ORG Sun Jun 8 10:21:30 2014 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6C3B5C7F; Sun, 8 Jun 2014 10:21:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C6882753; Sun, 8 Jun 2014 10:21:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s58ALU2C088525; Sun, 8 Jun 2014 10:21:30 GMT (envelope-from jceel@svn.freebsd.org) Received: (from jceel@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s58ALU2e088523; Sun, 8 Jun 2014 10:21:30 GMT (envelope-from jceel@svn.freebsd.org) Message-Id: <201406081021.s58ALU2e088523@svn.freebsd.org> From: Jakub Wojciech Klama Date: Sun, 8 Jun 2014 10:21:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r267224 - user/jceel/soc2014_evdev/contrib/xf86-input-evdev/src X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jun 2014 10:21:30 -0000 Author: jceel Date: Sun Jun 8 10:21:29 2014 New Revision: 267224 URL: http://svnweb.freebsd.org/changeset/base/267224 Log: Don't rely on ioctl() returning any positive value (as it can't do it on FreeBSD) Modified: user/jceel/soc2014_evdev/contrib/xf86-input-evdev/src/evdev.c Modified: user/jceel/soc2014_evdev/contrib/xf86-input-evdev/src/evdev.c ============================================================================== --- user/jceel/soc2014_evdev/contrib/xf86-input-evdev/src/evdev.c Sun Jun 8 10:18:22 2014 (r267223) +++ user/jceel/soc2014_evdev/contrib/xf86-input-evdev/src/evdev.c Sun Jun 8 10:21:29 2014 (r267224) @@ -1675,7 +1675,7 @@ static int EvdevCacheCompare(InputInfoPtr pInfo, BOOL compare) { EvdevPtr pEvdev = pInfo->private; - size_t len; + int ret; int i; char name[1024] = {0}; @@ -1698,58 +1698,58 @@ EvdevCacheCompare(InputInfoPtr pInfo, BO goto error; } - len = ioctl(pInfo->fd, EVIOCGBIT(0, sizeof(bitmask)), bitmask); - if (len < 0) { + ret = ioctl(pInfo->fd, EVIOCGBIT(0, sizeof(bitmask)), bitmask); + if (ret < 0) { xf86Msg(X_ERROR, "%s: ioctl EVIOCGBIT failed: %s\n", pInfo->name, strerror(errno)); goto error; } if (!compare) { - memcpy(pEvdev->bitmask, bitmask, len); - } else if (memcmp(pEvdev->bitmask, bitmask, len)) { + memcpy(pEvdev->bitmask, bitmask, sizeof(bitmask)); + } else if (memcmp(pEvdev->bitmask, bitmask, sizeof(bitmask))) { xf86Msg(X_ERROR, "%s: device bitmask has changed\n", pInfo->name); goto error; } - len = ioctl(pInfo->fd, EVIOCGBIT(EV_REL, sizeof(rel_bitmask)), rel_bitmask); - if (len < 0) { + ret = ioctl(pInfo->fd, EVIOCGBIT(EV_REL, sizeof(rel_bitmask)), rel_bitmask); + if (ret < 0) { xf86Msg(X_ERROR, "%s: ioctl EVIOCGBIT failed: %s\n", pInfo->name, strerror(errno)); goto error; } if (!compare) { - memcpy(pEvdev->rel_bitmask, rel_bitmask, len); - } else if (memcmp(pEvdev->rel_bitmask, rel_bitmask, len)) { + memcpy(pEvdev->rel_bitmask, rel_bitmask, sizeof(rel_bitmask)); + } else if (memcmp(pEvdev->rel_bitmask, rel_bitmask, sizeof(rel_bitmask))) { xf86Msg(X_ERROR, "%s: device rel_bitmask has changed\n", pInfo->name); goto error; } - len = ioctl(pInfo->fd, EVIOCGBIT(EV_ABS, sizeof(abs_bitmask)), abs_bitmask); - if (len < 0) { + ret = ioctl(pInfo->fd, EVIOCGBIT(EV_ABS, sizeof(abs_bitmask)), abs_bitmask); + if (ret < 0) { xf86Msg(X_ERROR, "%s: ioctl EVIOCGBIT failed: %s\n", pInfo->name, strerror(errno)); goto error; } if (!compare) { - memcpy(pEvdev->abs_bitmask, abs_bitmask, len); - } else if (memcmp(pEvdev->abs_bitmask, abs_bitmask, len)) { + memcpy(pEvdev->abs_bitmask, abs_bitmask, sizeof(abs_bitmask)); + } else if (memcmp(pEvdev->abs_bitmask, abs_bitmask, sizeof(abs_bitmask))) { xf86Msg(X_ERROR, "%s: device abs_bitmask has changed\n", pInfo->name); goto error; } - len = ioctl(pInfo->fd, EVIOCGBIT(EV_LED, sizeof(led_bitmask)), led_bitmask); - if (len < 0) { + ret = ioctl(pInfo->fd, EVIOCGBIT(EV_LED, sizeof(led_bitmask)), led_bitmask); + if (ret < 0) { xf86Msg(X_ERROR, "%s: ioctl EVIOCGBIT failed: %s\n", pInfo->name, strerror(errno)); goto error; } if (!compare) { - memcpy(pEvdev->led_bitmask, led_bitmask, len); - } else if (memcmp(pEvdev->led_bitmask, led_bitmask, len)) { + memcpy(pEvdev->led_bitmask, led_bitmask, sizeof(led_bitmask)); + } else if (memcmp(pEvdev->led_bitmask, led_bitmask, sizeof(led_bitmask))) { xf86Msg(X_ERROR, "%s: device led_bitmask has changed\n", pInfo->name); goto error; } @@ -1760,8 +1760,8 @@ EvdevCacheCompare(InputInfoPtr pInfo, BO */ for (i = ABS_X; i <= ABS_MAX; i++) { if (TestBit(i, abs_bitmask)) { - len = ioctl(pInfo->fd, EVIOCGABS(i), &pEvdev->absinfo[i]); - if (len < 0) { + ret = ioctl(pInfo->fd, EVIOCGABS(i), &pEvdev->absinfo[i]); + if (ret < 0) { xf86Msg(X_ERROR, "%s: ioctl EVIOCGABSi(%d) failed: %s\n", pInfo->name, i, strerror(errno)); goto error; @@ -1769,8 +1769,8 @@ EvdevCacheCompare(InputInfoPtr pInfo, BO } } - len = ioctl(pInfo->fd, EVIOCGBIT(EV_KEY, sizeof(key_bitmask)), key_bitmask); - if (len < 0) { + ret = ioctl(pInfo->fd, EVIOCGBIT(EV_KEY, sizeof(key_bitmask)), key_bitmask); + if (ret < 0) { xf86Msg(X_ERROR, "%s: ioctl EVIOCGBIT failed: %s\n", pInfo->name, strerror(errno)); goto error; @@ -1789,16 +1789,16 @@ EvdevCacheCompare(InputInfoPtr pInfo, BO size_t end_word = KEY_OK / LONG_BITS; size_t end_byte = end_word * sizeof(unsigned long); - if (len >= start_byte && + if (sizeof(key_bitmask) >= start_byte && memcmp(&pEvdev->key_bitmask[start_word], &key_bitmask[start_word], - min(len, end_byte) - start_byte + 1)) { + min(sizeof(key_bitmask), end_byte) - start_byte + 1)) { xf86Msg(X_ERROR, "%s: device key_bitmask has changed\n", pInfo->name); goto error; } } /* Copy the data so we have reasonably up-to-date info */ - memcpy(pEvdev->key_bitmask, key_bitmask, len); + memcpy(pEvdev->key_bitmask, key_bitmask, sizeof(key_bitmask)); return Success;