rem: return ((inputfd < 0) ? (count > 0) : FD_ISSET(inputfd, &rset));
add: return (count > 0);
context: W_HandleInputEvents(Bool waitForInput, int inputfd){#if defined(HAVE_POLL) && defined(HAVE_POLL_H) && !defined(HAVE_SELECT)    struct poll fd *fds;    InputHandler *handler;    int count, timeout, nfds, i, extrafd, retval;    extrafd = (inputfd < 0) ? 0 : 1;    if (inputHandler)        nfds = WMGetBagItemCount(inputHandler);    else        nfds = 0;    if (!extrafd && nfds==0) {        W_FlushASAPNotificationQueue();        return False;    }    fds = wmalloc((nfds+extrafd) * sizeof(struct pollfd));    if (extrafd) {        /* put this to the end of array to avoid using ranges from 1 to nfds+1 */        fds[nfds].fd = inputfd;        fds[nfds].events = POLLIN;    }    for (i = 0; i<nfds; i++) {        handler = WMGetFromBag(inputHandler, i);        fds[i].fd = handler->fd;        fds[i].events = 0;        if (handler->mask & WIReadMask)            fds[i].events |= POLLIN;        if (handler->mask & WIWriteMask)            fds[i].events |= POLLOUT;#if 0 /* FIXME */        if (handler->mask & WIExceptMask)            FD_SET(handler->fd, &eset);#endif    }    /*     * Setup the timeout to the estimated time until the     * next timer expires.     */    if (!waitForInput) {        timeout = 0;    } else if (timerPending()) {        struct timeval tv;        delayUntilNextTimerEvent(&tv);        timeout = tv.tv_sec * 1000 + tv.tv_usec / 1000;    } else {        timeout = -1;    }    count = poll(fds, nfds+extrafd, timeout);    if (count>0 && nfds>0) {        WMBag *handlerCopy = WMCreateBag(nfds);        for (i=0; i<nfds; i++)            WMPutInBag(handlerCopy, WMGetFromBag(inputHandler, i));        for (i=0; i<nfds; i++) {            int mask;            handler = WMGetFromBag(handlerCopy, i);            /* check if the handler still exist or was removed by a callback */            if (WMGetFirstInBag(inputHandler, handler) == WBNotFound)                continue;            mask = 0;            if ((handler->mask & WIReadMask) &&                (fds[i].revents & (POLLIN|POLLRDNORM|POLLRDBAND|POLLPRI)))                mask |= WIReadMask;            if ((handler->mask & WIWriteMask) &&                (fds[i].revents & (POLLOUT | POLLWRBAND)))                mask |= WIWriteMask;            if ((handler->mask & WIExceptMask) &&                (fds[i].revents & (POLLHUP | POLLNVAL | POLLERR)))                mask |= WIExceptMask;            if (mask!=0 && handler->callback) {                (*handler->callback)(handler->fd, mask,                                     handler->clientData);            }        }        WMFreeBag(handlerCopy);    }    /* we may only return count>0, because the returned value is not checked     * anywhere anyway. -Dan     */    retval = ((inputfd < 0) ? (count > 0) :              fds[nfds].revents & (POLLIN|POLLRDNORM|POLLRDBAND|POLLPRI));    wfree(fds);    W_FlushASAPNotificationQueue();    return retval;#else#ifdef HAVE_SELECT    struct timeval timeout;    struct timeval *timeoutPtr;    fd_set rset, wset, eset;    int maxfd, nfds, i;    int count;    InputHandler *handler;    if (inputHandler)        nfds = WMGetBagItemCount(inputHandler);    else        nfds = 0;    if (inputfd<0 && nfds==0) {        W_FlushASAPNotificationQueue();        return False;    }    FD_ZERO(&rset);    FD_ZERO(&wset);    FD_ZERO(&eset);    if (inputfd < 0) {        maxfd = 0;    } else {        FD_SET(inputfd, &rset);        maxfd = inputfd;    }    for (i=0; i<nfds; i++) {        handler = WMGetFromBag(inputHandler, i);        if (handler->mask & WIReadMask)            FD_SET(handler->fd, &rset);        if (handler->mask & WIWriteMask)            FD_SET(handler->fd, &wset);        if (handler->mask & WIExceptMask)            FD_SET(handler->fd, &eset);        if (maxfd < handler->fd)            maxfd = handler->fd;    }    /*     * Setup the timeout to the estimated time until the     * next timer expires.     */    if (!waitForInput) {        SET_ZERO(timeout);        timeoutPtr = &timeout;    } else if (timerPending()) {        delayUntilNextTimerEvent(&timeout);        timeoutPtr = &timeout;    } else {        timeoutPtr = (struct timeval*)0;    }    count = select(1 + maxfd, &rset, &wset, &eset, timeoutPtr);    if (count>0 && nfds>0) {        WMBag *handlerCopy = WMCreateBag(nfds);        for (i=0; i<nfds; i++)            WMPutInBag(handlerCopy, WMGetFromBag(inputHandler, i));        for (i=0; i<nfds; i++) {            int mask;            handler = WMGetFromBag(handlerCopy, i);            /* check if the handler still exist or was removed by a callback */            if (WMGetFirstInBag(inputHandler, handler) == WBNotFound)                continue;            mask = 0;            if ((handler->mask & WIReadMask) && FD_ISSET(handler->fd, &rset))                mask |= WIReadMask;            if ((handler->mask & WIWriteMask) && FD_ISSET(handler->fd, &wset))                mask |= WIWriteMask;            if ((handler->mask & WIExceptMask) && FD_ISSET(handler->fd, &eset))                mask |= WIExceptMask;            if (mask!=0 && handler->callback) {                (*handler->callback)(handler->fd, mask,                                     handler->clientData);            }        }        WMFreeBag(handlerCopy);    }    W_FlushASAPNotificationQueue();    return ((inputfd < 0) ? (count > 0) : FD_ISSET(inputfd, &rset));#else /* not HAVE_SELECT, not HAVE_POLL */    Neither select nor poll. You lose.#endif /* HAVE_SELECT */#endif /* HAVE_POLL */}