aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2017-12-10 21:36:15 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-12-11 09:45:06 +0100
commit0eb1dc67d363032e76076aa4d01cf0615f8eb092 (patch)
tree751e5beaf2176c2b86953c1226bd33ecbd4aeb76
parent4988e7c5f2ad60c223077ffe83a28b5122c688fd (diff)
downloadnx-libs-0eb1dc67d363032e76076aa4d01cf0615f8eb092.tar.gz
nx-libs-0eb1dc67d363032e76076aa4d01cf0615f8eb092.tar.bz2
nx-libs-0eb1dc67d363032e76076aa4d01cf0615f8eb092.zip
Xtranssock.c: simplify code in SocketWritev
Code was here twice and could be simply merged.
-rw-r--r--nx-X11/lib/include/xtrans/Xtranssock.c44
1 files changed, 0 insertions, 44 deletions
diff --git a/nx-X11/lib/include/xtrans/Xtranssock.c b/nx-X11/lib/include/xtrans/Xtranssock.c
index f59c336dc..a7470edcd 100644
--- a/nx-X11/lib/include/xtrans/Xtranssock.c
+++ b/nx-X11/lib/include/xtrans/Xtranssock.c
@@ -2874,48 +2874,7 @@ TRANS(SocketWritev) (XtransConnInfo ciptr, struct iovec *buf, int size)
{
return NXTransWriteVector(ciptr->fd, buf, size);
}
- else
- {
- /* FIXME: same code as below, should be possible without duplication */
-#if XTRANS_SEND_FDS
- if (ciptr->send_fds)
- {
- union fd_pass cmsgbuf;
- int nfd = nFd(&ciptr->send_fds);
- struct _XtransConnFd *cf = ciptr->send_fds;
- struct msghdr msg = {
- .msg_name = NULL,
- .msg_namelen = 0,
- .msg_iov = buf,
- .msg_iovlen = size,
- .msg_control = cmsgbuf.buf,
- .msg_controllen = CMSG_LEN(nfd * sizeof(int))
- };
- struct cmsghdr *hdr = CMSG_FIRSTHDR(&msg);
- int i;
- int *fds;
-
- hdr->cmsg_len = msg.msg_controllen;
- hdr->cmsg_level = SOL_SOCKET;
- hdr->cmsg_type = SCM_RIGHTS;
-
- fds = (int *) CMSG_DATA(hdr);
- /* Set up fds */
- for (i = 0; i < nfd; i++) {
- fds[i] = cf->fd;
- cf = cf->next;
- }
-
- i = sendmsg(ciptr->fd, &msg, 0);
- if (i > 0)
- discardFd(&ciptr->send_fds, cf, 0);
- return i;
- }
#endif
- return WRITEV (ciptr, buf, size);
- }
-
-#else /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */
#if XTRANS_SEND_FDS
if (ciptr->send_fds)
@@ -2953,11 +2912,8 @@ TRANS(SocketWritev) (XtransConnInfo ciptr, struct iovec *buf, int size)
}
#endif
return WRITEV (ciptr, buf, size);
-
-#endif /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */
}
-
static int
TRANS(SocketWrite) (XtransConnInfo ciptr, char *buf, int size)