From f69cd2024ef25e7fd2bd2d7012e33ce16eeb79ff Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Thu, 8 Mar 2018 11:13:16 -0500 Subject: [PATCH] os: Define {ReadFdFrom,WriteFdTo}Client unconditionally MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise this is broken on cygwin: rrlease.c: In function ‘ProcRRCreateLease’: rrlease.c:305:9: error: implicit declaration of function ‘WriteFdToClient’ [-Werror=implicit-function-declaration] if (WriteFdToClient(client, fd, TRUE) < 0) { Signed-off-by: Adam Jackson --- include/dixstruct.h | 2 -- include/os.h | 2 -- os/io.c | 9 +++++++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/dixstruct.h b/include/dixstruct.h index ad3352ae5..fb0ac14b8 100644 --- a/include/dixstruct.h +++ b/include/dixstruct.h @@ -113,14 +113,12 @@ typedef struct _Client { int req_fds; } ClientRec; -#if XTRANS_SEND_FDS static inline void SetReqFds(ClientPtr client, int req_fds) { if (client->req_fds != 0 && req_fds != client->req_fds) LogMessage(X_ERROR, "Mismatching number of request fds %d != %d\n", req_fds, client->req_fds); client->req_fds = req_fds; } -#endif /* * Scheduling interface diff --git a/include/os.h b/include/os.h index e141a6b02..c956378b2 100644 --- a/include/os.h +++ b/include/os.h @@ -106,11 +106,9 @@ extern _X_EXPORT Bool WaitForSomething(Bool clients_are_ready); extern _X_EXPORT int ReadRequestFromClient(ClientPtr /*client */ ); -#if XTRANS_SEND_FDS extern _X_EXPORT int ReadFdFromClient(ClientPtr client); extern _X_EXPORT int WriteFdToClient(ClientPtr client, int fd, Bool do_close); -#endif extern _X_EXPORT Bool InsertFakeRequest(ClientPtr /*client */ , char * /*data */ , diff --git a/os/io.c b/os/io.c index 955c24924..b099f0967 100644 --- a/os/io.c +++ b/os/io.c @@ -464,12 +464,12 @@ ReadRequestFromClient(ClientPtr client) return needed; } -#if XTRANS_SEND_FDS int ReadFdFromClient(ClientPtr client) { int fd = -1; +#if XTRANS_SEND_FDS if (client->req_fds > 0) { OsCommPtr oc = (OsCommPtr) client->osPrivate; @@ -477,17 +477,22 @@ ReadFdFromClient(ClientPtr client) fd = _XSERVTransRecvFd(oc->trans_conn); } else LogMessage(X_ERROR, "Request asks for FD without setting req_fds\n"); +#endif + return fd; } int WriteFdToClient(ClientPtr client, int fd, Bool do_close) { +#if XTRANS_SEND_FDS OsCommPtr oc = (OsCommPtr) client->osPrivate; return _XSERVTransSendFd(oc->trans_conn, fd, do_close); -} +#else + return -1; #endif +} /***************************************************************** * InsertFakeRequest