X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=comstack%2Funix.c;h=23c60ab709e0e1570306321e1907a208c51a6aa0;hb=ea8a7e8ee5a459c4a995bf7d422ae2bca97c644d;hp=908ab7e6b780a4b46b2118ce47ee0aa8a120b667;hpb=4d531a1a9131d69c3b6c27fbac42837e22cff61c;p=yaz-moved-to-github.git diff --git a/comstack/unix.c b/comstack/unix.c index 908ab7e..23c60ab 100644 --- a/comstack/unix.c +++ b/comstack/unix.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2003, Index Data * See the file LICENSE for details. * - * $Id: unix.c,v 1.9 2003-01-06 08:20:27 adam Exp $ + * $Id: unix.c,v 1.13 2003-09-16 20:48:28 adam Exp $ * UNIX socket COMSTACK. By Morten Bøgeskov. */ #ifndef WIN32 @@ -22,9 +22,7 @@ #include #include #include - -/* Chas added the following, so we get the definition of completeBER */ -#include +#include #ifndef YAZ_SOCKLEN_T #define YAZ_SOCKLEN_T int @@ -140,7 +138,7 @@ COMSTACK unix_type(int s, int blocking, int protocol, void *vp) if (protocol == PROTO_WAIS) state->complete = completeWAIS; else - state->complete = completeBER; + state->complete = cs_complete_auto; p->timeout = COMSTACK_DEFAULT_TIMEOUT; TRC(fprintf(stderr, "Created new UNIX comstack\n")); @@ -294,6 +292,7 @@ static int unix_bind(COMSTACK h, void *address, int mode) h->cerrno = CSYSERR; return -1; } + chmod(path, 0777); if (mode == CS_SERVER && listen(h->iofile, 3) < 0) { h->cerrno = CSYSERR; @@ -309,7 +308,7 @@ static int unix_listen(COMSTACK h, char *raddr, int *addrlen, void *cd) { struct sockaddr_un addr; - YAZ_SOCKLEN_T len = SUN_LEN(&addr); + YAZ_SOCKLEN_T len = sizeof(addr); TRC(fprintf(stderr, "unix_listen pid=%d\n", getpid())); if (h->state != CS_ST_IDLE) @@ -389,6 +388,7 @@ static COMSTACK unix_accept(COMSTACK h) state->altsize = state->altlen = 0; state->towrite = state->written = -1; state->complete = st->complete; + memcpy(&state->addr, &st->addr, sizeof(state->addr)); cnew->state = CS_ST_ACCEPT; cnew->event = CS_NONE; h->state = CS_ST_IDLE;