X-Git-Url: http://git.demorecorder.com/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fxcb_in.c;h=14b67aec2fd346074b04b04d0c7637bb1e801614;hb=1f6cd9f1fcd3c07d323b678292c9cb00ae1f7504;hp=fd6c2efd216491b6aa5f36a10949bed9e34c716f;hpb=c7c5b710f2cc0782412c9e159986c96b52aa0d02;p=free-sw%2Fxcb%2Flibxcb diff --git a/src/xcb_in.c b/src/xcb_in.c index fd6c2ef..14b67ae 100644 --- a/src/xcb_in.c +++ b/src/xcb_in.c @@ -200,9 +200,9 @@ static int read_packet(xcb_connection_t *c) c->in.request_completed = c->in.request_read - 1; } - while(c->in.pending_replies && + while(c->in.pending_replies && c->in.pending_replies->workaround != WORKAROUND_EXTERNAL_SOCKET_OWNER && - XCB_SEQUENCE_COMPARE (c->in.pending_replies->last_request, <=, c->in.request_completed)) + XCB_SEQUENCE_COMPARE (c->in.pending_replies->last_request, <=, c->in.request_completed)) { pending_reply *oldpend = c->in.pending_replies; c->in.pending_replies = oldpend->next; @@ -386,11 +386,11 @@ static int read_block(const int fd, void *buf, const ssize_t len) FD_ZERO(&fds); FD_SET(fd, &fds); - /* 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); + /* 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) @@ -746,7 +746,7 @@ xcb_register_for_special_xge(xcb_connection_t *c, pthread_mutex_unlock(&c->iolock); return NULL; } - + se->extension = ext_reply->major_opcode; se->eid = eid; @@ -918,11 +918,13 @@ int _xcb_in_read(xcb_connection_t *c) #if HAVE_SENDMSG struct cmsghdr *hdr; - for (hdr = CMSG_FIRSTHDR(&msg); hdr; hdr = CMSG_NXTHDR(&msg, hdr)) { - if (hdr->cmsg_level == SOL_SOCKET && hdr->cmsg_type == SCM_RIGHTS) { - int nfd = (hdr->cmsg_len - CMSG_LEN(0)) / sizeof (int); - memcpy(&c->in.in_fd.fd[c->in.in_fd.nfd], CMSG_DATA(hdr), nfd * sizeof (int)); - c->in.in_fd.nfd += nfd; + if (msg.msg_controllen >= sizeof (struct cmsghdr)) { + for (hdr = CMSG_FIRSTHDR(&msg); hdr; hdr = CMSG_NXTHDR(&msg, hdr)) { + if (hdr->cmsg_level == SOL_SOCKET && hdr->cmsg_type == SCM_RIGHTS) { + int nfd = (hdr->cmsg_len - CMSG_LEN(0)) / sizeof (int); + memcpy(&c->in.in_fd.fd[c->in.in_fd.nfd], CMSG_DATA(hdr), nfd * sizeof (int)); + c->in.in_fd.nfd += nfd; + } } } #endif