X-Git-Url: http://git.demorecorder.com/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fxcb_util.c;h=1bde7b79c86d3a6586a624e104d3e7a6ff626e2b;hb=4f25ee16443b29e1a25bd26a724e1e0a577e21ff;hp=5a82ac129c6b2434306e6e0b790d5dcab50339e8;hpb=de3cdad87a341c238c544425f4dd574b19c58ae3;p=free-sw%2Fxcb%2Flibxcb diff --git a/src/xcb_util.c b/src/xcb_util.c index 5a82ac1..1bde7b7 100644 --- a/src/xcb_util.c +++ b/src/xcb_util.c @@ -27,29 +27,34 @@ #include #include -#include #include -#include -#include -#include -#ifdef DNETCONN -#include -#include -#endif -#include #include #include #include #include #include -#include #include +#ifdef _WIN32 +#include "xcb_windefs.h" +#else +#include +#include +#include +#include +#include +#include +#endif /* _WIN32 */ + #include "xcb.h" #include "xcbext.h" #include "xcbint.h" -static const int error_connection = 1; +/* must be after "xcbint.h" to get autoconf #defines */ +#if defined(HAVE_TSOL_LABEL_H) && defined(HAVE_IS_SYSTEM_LABELED) +# include +# include +#endif int xcb_popcount(uint32_t mask) { @@ -59,6 +64,16 @@ int xcb_popcount(uint32_t mask) return ((y + (y >> 3)) & 030707070707) % 077; } +int xcb_sumof(uint8_t *list, int len) +{ + int i, s = 0; + for(i=0; i= 0) fcntl(fd, F_SETFD, FD_CLOEXEC); +#endif } return fd; } -#ifdef DNETCONN -static int _xcb_open_decnet(const char *host, const char *protocol, const unsigned short port) -{ - int fd; - struct sockaddr_dn addr; - struct accessdata_dn accessdata; - struct nodeent *nodeaddr = getnodebyname(host); - - if(!nodeaddr) - return -1; - if (protocol && strcmp("dnet",protocol)) - return -1; - addr.sdn_family = AF_DECnet; - - addr.sdn_add.a_len = nodeaddr->n_length; - memcpy(addr.sdn_add.a_addr, nodeaddr->n_addr, addr.sdn_add.a_len); - - addr.sdn_objnamel = sprintf((char *)addr.sdn_objname, "X$X%d", port); - if(addr.sdn_objnamel < 0) - return -1; - addr.sdn_objnum = 0; - - fd = _xcb_socket(PF_DECnet, SOCK_STREAM, 0); - if(fd == -1) - return -1; - - memset(&accessdata, 0, sizeof(accessdata)); - accessdata.acc_accl = sprintf((char*)accessdata.acc_acc, "%d", getuid()); - if(accessdata.acc_accl < 0) - return -1; - setsockopt(fd, DNPROTO_NSP, SO_CONACCESS, &accessdata, sizeof(accessdata)); - - if(connect(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1) { - close(fd); - return -1; - } - return fd; -} -#endif static int _xcb_open_tcp(const char *host, char *protocol, const unsigned short port) { @@ -297,9 +277,6 @@ static int _xcb_open_tcp(const char *host, char *protocol, const unsigned short host = "localhost"; memset(&hints, 0, sizeof(hints)); -#ifdef AI_ADDRCONFIG - hints.ai_flags |= AI_ADDRCONFIG; -#endif #ifdef AI_NUMERICSERV hints.ai_flags |= AI_NUMERICSERV; #endif @@ -340,6 +317,7 @@ static int _xcb_open_tcp(const char *host, char *protocol, const unsigned short return fd; } +#ifndef _WIN32 static int _xcb_open_unix(char *protocol, const char *file) { int fd; @@ -362,6 +340,7 @@ static int _xcb_open_unix(char *protocol, const char *file) } return fd; } +#endif /* !_WIN32 */ #ifdef HAVE_ABSTRACT_SOCKETS static int _xcb_open_abstract(char *protocol, const char *file, size_t filelen)