[Xcb] xcb_in.c read_block() error handling looks wrong for _WIN32

Jeremy Huddleston Sequoia jeremyhu at gmail.com
Tue Aug 11 09:52:48 PDT 2015

In read_block in src/xcb_in.c, we see:

        if(...) {
            /* Initializing errno here makes sure that for Win32 this loop will execute only once */
            errno = 0;
            do {
                ret = select(fd + 1, &fds, 0, 0, 0);
            } while (ret == -1 && errno == EINTR);
#endif /* USE_POLL */
        if(ret <= 0)
            return ret;

I'm not much of an expert of _WIN32, but based on the comment, this looks wrong.  From the comment, am I assume that on _WIN32, select(2) does not set errno or maybe doesn't set it to EINTR in the case the analogous EINTR case on _WIN32.  However, the line immediately following will exit the function for _WIN32.

I don't know what the right solution is because I'm making a lot of guesses about Win32, but it just looks wrong to me, so someone more aware of Win32 should maybe take a look at this.


More information about the Xcb mailing list