diff options
Diffstat (limited to 'libxcb/src/xcb_auth.c')
-rw-r--r-- | libxcb/src/xcb_auth.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libxcb/src/xcb_auth.c b/libxcb/src/xcb_auth.c index d774d1069..99b2fbbcc 100644 --- a/libxcb/src/xcb_auth.c +++ b/libxcb/src/xcb_auth.c @@ -25,6 +25,10 @@ /* Authorization systems for the X protocol. */ +#ifdef WIN32 +#define INCL_WINSOCK_API_TYPEDEFS 1 /* Needed for LPFN_GETPEERNAME */ +#endif + #include <assert.h> #include <X11/Xauth.h> #include <sys/socket.h> @@ -245,13 +249,14 @@ static int compute_auth(xcb_auth_info_t *info, Xauth *authptr, struct sockaddr * /* `sockaddr_un.sun_path' typical size usually ranges between 92 and 108 */ #define INITIAL_SOCKNAME_SLACK 108 +#ifndef WIN32 +typedef int (*LPFN_GETPEERNAME)(int,struct sockaddr *,socklen_t *); +#endif /* Return a dynamically allocated socket address structure according to the value returned by either getpeername() or getsockname() (according to POSIX, applications should not assume a particular length for `sockaddr_un.sun_path') */ -static struct sockaddr *get_peer_sock_name(int (*socket_func)(int, - struct sockaddr *, - socklen_t *), +static struct sockaddr *get_peer_sock_name(LPFN_GETPEERNAME socket_func, int fd) { socklen_t socknamelen = sizeof(struct sockaddr) + INITIAL_SOCKNAME_SLACK; |