diff options
author | marha <marha@users.sourceforge.net> | 2013-11-07 08:23:50 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-11-07 08:23:50 +0100 |
commit | 51c3a4e7b08aa904ff2af52a9f6f7adc748b361f (patch) | |
tree | 38fa447dc8970b83becb4d35487d2bb2e565301b /xorg-server/os/io.c | |
parent | d79b6645eb21ca82d506ef038b8ea71a1e431f3f (diff) | |
parent | 31fd4c5654595a4763e492e4ec26f66ca3a8a405 (diff) | |
download | vcxsrv-51c3a4e7b08aa904ff2af52a9f6f7adc748b361f.tar.gz vcxsrv-51c3a4e7b08aa904ff2af52a9f6f7adc748b361f.tar.bz2 vcxsrv-51c3a4e7b08aa904ff2af52a9f6f7adc748b361f.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
libxtrans fontconfig mesa xserver pixman xkbcomp git update 4 nov 2013
Conflicts:
xorg-server/Xext/shm.c
xorg-server/os/xstrans.c
Diffstat (limited to 'xorg-server/os/io.c')
-rw-r--r-- | xorg-server/os/io.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/xorg-server/os/io.c b/xorg-server/os/io.c index 2c8b05a76..c0bd68d97 100644 --- a/xorg-server/os/io.c +++ b/xorg-server/os/io.c @@ -259,6 +259,12 @@ ReadRequestFromClient(ClientPtr client) oc->input = oci; } + /* Discard any unused file descriptors */ + while (client->req_fds > 0) { + int req_fd = ReadFdFromClient(client); + if (req_fd >= 0) + close(req_fd); + } /* advance to start of next request */ oci->bufptr += oci->lenLastReq; @@ -485,6 +491,29 @@ ReadRequestFromClient(ClientPtr client) return needed; } +int +ReadFdFromClient(ClientPtr client) +{ + int fd = -1; + + if (client->req_fds > 0) { + OsCommPtr oc = (OsCommPtr) client->osPrivate; + + --client->req_fds; + fd = _XSERVTransRecvFd(oc->trans_conn); + } else + LogMessage(X_ERROR, "Request asks for FD without setting req_fds\n"); + return fd; +} + +int +WriteFdToClient(ClientPtr client, int fd, Bool do_close) +{ + OsCommPtr oc = (OsCommPtr) client->osPrivate; + + return _XSERVTransSendFd(oc->trans_conn, fd, do_close); +} + /***************************************************************** * InsertFakeRequest * Splice a consed up (possibly partial) request in as the next request. |