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
Added GCC option -Wstrict-prototypes to buildconf.sh -d. Updated code
[yaz-moved-to-github.git]
/
src
/
tcpip.c
diff --git
a/src/tcpip.c
b/src/tcpip.c
index
af2d813
..
a16fe5e
100644
(file)
--- a/
src/tcpip.c
+++ b/
src/tcpip.c
@@
-2,7
+2,7
@@
* Copyright (C) 1995-2006, Index Data ApS
* See the file LICENSE for details.
*
* Copyright (C) 1995-2006, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: tcpip.c,v 1.28 2006-09-06 15:01:53 adam Exp $
+ * $Id: tcpip.c,v 1.31 2006-09-21 15:55:25 adam Exp $
*/
/**
* \file tcpip.c
*/
/**
* \file tcpip.c
@@
-322,10
+322,15
@@
void *tcpip_straddr(COMSTACK h, const char *str)
sp->ai = tcpip_getaddrinfo(str, port);
if (sp->ai && h->state == CS_ST_UNBND)
{
sp->ai = tcpip_getaddrinfo(str, port);
if (sp->ai && h->state == CS_ST_UNBND)
{
- int s;
+ int s = -1;
struct addrinfo *ai = sp->ai;
struct addrinfo *ai = sp->ai;
- s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
- if (s < 0)
+ for (; ai; ai = ai->ai_next)
+ {
+ s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
+ if (s != -1)
+ break;
+ }
+ if (s == -1)
return 0;
h->iofile = s;
return 0;
h->iofile = s;
@@
-354,7
+359,7
@@
void *tcpip_straddr(COMSTACK h, const char *str)
return 0;
h->iofile = s;
return 0;
h->iofile = s;
- if (!tcpip_set_blocking(h, h->blocking))
+ if (!tcpip_set_blocking(h, h->flags))
return 0;
}
return &sp->addr;
return 0;
}
return &sp->addr;
@@
-560,7
+565,7
@@
static int tcpip_bind(COMSTACK h, void *address, int mode)
#ifdef WIN32
BOOL one = 1;
#else
#ifdef WIN32
BOOL one = 1;
#else
- unsigned long one = 1;
+ int one = 1;
#endif
#if HAVE_GETADDRINFO
#endif
#if HAVE_GETADDRINFO