aboutsummaryrefslogtreecommitdiff
path: root/X11/xtrans/Xtranssock.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-11-22 08:51:58 +0100
committermarha <marha@users.sourceforge.net>2013-11-22 08:51:58 +0100
commit7dbaa1cffdf176f803f2c7069fb6810e16a86f72 (patch)
treee12bbf56a362758517fa9c26e46eca212448aca7 /X11/xtrans/Xtranssock.c
parent4887502815f54a96dce04c1f503f9e5f6ea7408a (diff)
parent697f071e3dcd3b01dba050d6c5316f2a23ee82f8 (diff)
downloadvcxsrv-7dbaa1cffdf176f803f2c7069fb6810e16a86f72.tar.gz
vcxsrv-7dbaa1cffdf176f803f2c7069fb6810e16a86f72.tar.bz2
vcxsrv-7dbaa1cffdf176f803f2c7069fb6810e16a86f72.zip
Merge remote-tracking branch 'origin/released'
* origin/released: libxtrans mesa git update 22 nov 2013
Diffstat (limited to 'X11/xtrans/Xtranssock.c')
-rwxr-xr-xX11/xtrans/Xtranssock.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/X11/xtrans/Xtranssock.c b/X11/xtrans/Xtranssock.c
index bbc08f4e0..6d4207f1c 100755
--- a/X11/xtrans/Xtranssock.c
+++ b/X11/xtrans/Xtranssock.c
@@ -2202,27 +2202,11 @@ TRANS(SocketSendFd) (XtransConnInfo ciptr, int fd, int do_close)
#define MAX_FDS 128
-struct fd_pass {
+union fd_pass {
struct cmsghdr cmsghdr;
- int fd[MAX_FDS];
+ char buf[CMSG_SPACE(MAX_FDS * sizeof(int))];
};
-static inline void init_msg_recv(struct msghdr *msg, struct iovec *iov, int niov, struct fd_pass *pass, int nfd) {
- msg->msg_name = NULL;
- msg->msg_namelen = 0;
- msg->msg_iov = iov;
- msg->msg_iovlen = niov;
- msg->msg_control = pass;
- msg->msg_controllen = sizeof (struct cmsghdr) + nfd * sizeof (int);
-}
-
-static inline void init_msg_send(struct msghdr *msg, struct iovec *iov, int niov, struct fd_pass *pass, int nfd) {
- init_msg_recv(msg, iov, niov, pass, nfd);
- pass->cmsghdr.cmsg_len = msg->msg_controllen;
- pass->cmsghdr.cmsg_level = SOL_SOCKET;
- pass->cmsghdr.cmsg_type = SCM_RIGHTS;
-}
-
#endif /* XTRANS_SEND_FDS */
static int
@@ -2260,13 +2244,13 @@ TRANS(SocketRead) (XtransConnInfo ciptr, char *buf, int size)
.iov_base = buf,
.iov_len = size
};
- char cmsgbuf[CMSG_SPACE(sizeof(int) * MAX_FDS)];
+ union fd_pass cmsgbuf;
struct msghdr msg = {
.msg_name = NULL,
.msg_namelen = 0,
.msg_iov = &iov,
.msg_iovlen = 1,
- .msg_control = cmsgbuf,
+ .msg_control = cmsgbuf.buf,
.msg_controllen = CMSG_LEN(MAX_FDS * sizeof(int))
};
@@ -2301,13 +2285,13 @@ TRANS(SocketReadv) (XtransConnInfo ciptr, struct iovec *buf, int size)
#if XTRANS_SEND_FDS
{
- char cmsgbuf[CMSG_SPACE(sizeof(int) * MAX_FDS)];
+ union fd_pass cmsgbuf;
struct msghdr msg = {
.msg_name = NULL,
.msg_namelen = 0,
.msg_iov = buf,
.msg_iovlen = size,
- .msg_control = cmsgbuf,
+ .msg_control = cmsgbuf.buf,
.msg_controllen = CMSG_LEN(MAX_FDS * sizeof(int))
};
@@ -2343,7 +2327,7 @@ TRANS(SocketWritev) (XtransConnInfo ciptr, struct iovec *buf, int size)
#if XTRANS_SEND_FDS
if (ciptr->send_fds)
{
- char cmsgbuf[CMSG_SPACE(sizeof(int) * MAX_FDS)];
+ union fd_pass cmsgbuf;
int nfd = nFd(&ciptr->send_fds);
struct _XtransConnFd *cf = ciptr->send_fds;
struct msghdr msg = {
@@ -2351,7 +2335,7 @@ TRANS(SocketWritev) (XtransConnInfo ciptr, struct iovec *buf, int size)
.msg_namelen = 0,
.msg_iov = buf,
.msg_iovlen = size,
- .msg_control = cmsgbuf,
+ .msg_control = cmsgbuf.buf,
.msg_controllen = CMSG_LEN(nfd * sizeof(int))
};
struct cmsghdr *hdr = CMSG_FIRSTHDR(&msg);