summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPetr Salinger <Petr.Salinger@seznam.cz>2008-07-07 17:57:37 +0200
committerJulien Danjou <julien@danjou.info>2008-07-07 17:57:37 +0200
commita9d15a08451c76a9250642c9f662f296196f60a0 (patch)
tree3bd9e1daef52a5f3fc047ecfe8ba5b648b276236 /src
parentee78071902e93ce22a3170f0937c158fd16894d8 (diff)
fix FreeBSD support
The GNU/kFreeBSD (and BSDs in general) have a different layout of struct sockaddr, sockaddr_in, sockaddr_un ... The first member do not have to be "sa_family", they also have "sa_len" field. Signed-off-by: Julien Danjou <julien@danjou.info>
Diffstat (limited to 'src')
-rw-r--r--src/xcb_util.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/xcb_util.c b/src/xcb_util.c
index 3eacc0d..8c18d71 100644
--- a/src/xcb_util.c
+++ b/src/xcb_util.c
@@ -246,13 +246,16 @@ static int _xcb_open_tcp(char *host, char *protocol, const unsigned short port)
static int _xcb_open_unix(char *protocol, const char *file)
{
int fd;
- struct sockaddr_un addr = { AF_UNIX };
+ struct sockaddr_un addr;
if (protocol && strcmp("unix",protocol))
return -1;
strcpy(addr.sun_path, file);
-
+ addr.sun_family = AF_UNIX;
+#if HAVE_SOCKADDR_SUN_LEN
+ addr.sun_len = SUN_LEN(&addr);
+#endif
fd = socket(AF_UNIX, SOCK_STREAM, 0);
if(fd == -1)
return -1;