projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Provide yaz_log_{lock,unlock}
[yaz-moved-to-github.git]
/
src
/
unix.c
diff --git
a/src/unix.c
b/src/unix.c
index
e37bf70
..
559740a
100644
(file)
--- a/
src/unix.c
+++ b/
src/unix.c
@@
-1,11
+1,14
@@
/* This file is part of the YAZ toolkit.
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2009 Index Data
+ * Copyright (C) Index Data
* See the file LICENSE for details.
*/
/**
* \file unix.c
* \brief Implements UNIX domain socket COMSTACK
*/
* See the file LICENSE for details.
*/
/**
* \file unix.c
* \brief Implements UNIX domain socket COMSTACK
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#ifndef WIN32
#ifndef WIN32
@@
-162,12
+165,8
@@
COMSTACK unix_type(int s, int flags, int protocol, void *vp)
state->altbuf = 0;
state->altsize = state->altlen = 0;
state->towrite = state->written = -1;
state->altbuf = 0;
state->altsize = state->altlen = 0;
state->towrite = state->written = -1;
- if (protocol == PROTO_WAIS)
- state->complete = completeWAIS;
- else
- state->complete = cs_complete_auto;
+ state->complete = cs_complete_auto;
- p->timeout = COMSTACK_DEFAULT_TIMEOUT;
TRC(fprintf(stderr, "Created new UNIX comstack\n"));
return p;
TRC(fprintf(stderr, "Created new UNIX comstack\n"));
return p;
@@
-194,12
+193,12
@@
static void *unix_straddr1(COMSTACK h, const char *str, char *f)
unix_state *sp = (unix_state *)h->cprivate;
char * s = f;
const char * file = NULL;
unix_state *sp = (unix_state *)h->cprivate;
char * s = f;
const char * file = NULL;
- char * eol;
sp->uid = sp->gid = sp->umask = -1;
sp->uid = sp->gid = sp->umask = -1;
- if ((eol = strchr(s, ',')))
+ if (strchr(s, '='))
{
{
+ char *eol;
do
{
if ((eol = strchr(s, ',')))
do
{
if ((eol = strchr(s, ',')))
@@
-244,7
+243,7
@@
static void *unix_straddr1(COMSTACK h, const char *str, char *f)
{
char * end;
char * arg = s + 6;
{
char * end;
char * arg = s + 6;
-
+
sp->umask = strtol(arg, &end, 8);
if (errno == EINVAL ||
*end)
sp->umask = strtol(arg, &end, 8);
if (errno == EINVAL ||
*end)
@@
-510,7
+509,7
@@
static COMSTACK unix_accept(COMSTACK h)
}
return 0;
}
}
return 0;
}
- if (!(cnew->flags&CS_FLAGS_BLOCKING) &&
+ if (!(cnew->flags&CS_FLAGS_BLOCKING) &&
(fcntl(cnew->iofile, F_SETFL, O_NONBLOCK) < 0)
)
{
(fcntl(cnew->iofile, F_SETFL, O_NONBLOCK) < 0)
)
{
@@
-566,8
+565,8
@@
static int unix_get(COMSTACK h, char **buf, int *bufsize)
TRC(fprintf(stderr, "unix_get: bufsize=%d\n", *bufsize));
if (sp->altlen) /* switch buffers */
{
TRC(fprintf(stderr, "unix_get: bufsize=%d\n", *bufsize));
if (sp->altlen) /* switch buffers */
{
- TRC(fprintf(stderr, " %d bytes in altbuf (0x%x)\n", sp->altlen,
- (unsigned) sp->altbuf));
+ TRC(fprintf(stderr, " %d bytes in altbuf (%p )\n", sp->altlen,
+ sp->altbuf));
tmpc = *buf;
tmpi = *bufsize;
*buf = sp->altbuf;
tmpc = *buf;
tmpi = *bufsize;
*buf = sp->altbuf;
@@
-629,8
+628,8
@@
static int unix_get(COMSTACK h, char **buf, int *bufsize)
} else if (sp->altsize < req)
if (!(sp->altbuf =(char *)xrealloc(sp->altbuf, sp->altsize = req)))
return -1;
} else if (sp->altsize < req)
if (!(sp->altbuf =(char *)xrealloc(sp->altbuf, sp->altsize = req)))
return -1;
- TRC(fprintf(stderr, " Moving %d bytes to altbuf(0x%x)\n", tomove,
- (unsigned) sp->altbuf));
+ TRC(fprintf(stderr, " Moving %d bytes to altbuf(%p)\n", tomove,
+ sp->altbuf));
memcpy(sp->altbuf, *buf + berlen, sp->altlen = tomove);
}
if (berlen < CS_UNIX_BUFCHUNK - 1)
memcpy(sp->altbuf, *buf + berlen, sp->altlen = tomove);
}
if (berlen < CS_UNIX_BUFCHUNK - 1)