X-Git-Url: http://git.demorecorder.com/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fxcb_auth.c;h=a5b730c0ca79a08686e6aeaca7fd3808600414f6;hb=cca607409068ad0948e7283fb8d0465cabc51686;hp=4839b78d60d6e3b502ac6f3b5fe6d6ebee885012;hpb=3c5813697169a33ecfd6ac0ab5641dec654f6612;p=free-sw%2Fxcb%2Flibxcb diff --git a/src/xcb_auth.c b/src/xcb_auth.c index 4839b78..a5b730c 100644 --- a/src/xcb_auth.c +++ b/src/xcb_auth.c @@ -25,15 +25,30 @@ /* Authorization systems for the X protocol. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include #include #include +#ifdef __INTERIX +/* _don't_ ask. interix has INADDR_LOOPBACK in here. */ +#include +#endif + #ifdef _WIN32 +#ifdef HASXDMAUTH +/* We must include the wrapped windows.h before any system header which includes + it unwrapped, to avoid conflicts with types defined in X headers */ +#include +#endif #include "xcb_windefs.h" #else +#include #include #include #include @@ -261,7 +276,7 @@ static struct sockaddr *get_peer_sock_name(int (*socket_func)(int, { socklen_t socknamelen = sizeof(struct sockaddr) + INITIAL_SOCKNAME_SLACK; socklen_t actual_socknamelen = socknamelen; - struct sockaddr *sockname = malloc(socknamelen), *new_sockname = NULL; + struct sockaddr *sockname = malloc(socknamelen); if (sockname == NULL) return NULL; @@ -274,14 +289,17 @@ static struct sockaddr *get_peer_sock_name(int (*socket_func)(int, if (actual_socknamelen > socknamelen) { + struct sockaddr *new_sockname = NULL; socknamelen = actual_socknamelen; - if ((new_sockname = realloc(sockname, actual_socknamelen)) == NULL || - socket_func(fd, new_sockname, &actual_socknamelen) == -1 || - actual_socknamelen > socknamelen) + if ((new_sockname = realloc(sockname, actual_socknamelen)) == NULL) goto sock_or_realloc_error; sockname = new_sockname; + + if (socket_func(fd, sockname, &actual_socknamelen) == -1 || + actual_socknamelen > socknamelen) + goto sock_or_realloc_error; } return sockname;