gethostbyname_r is used instead of gethostbyname - when available.
+Fixed bug #644: Using Non Reentrant gethostbyname causes SIGSEGV.
+
New option for yaz-marcdump -lpos=value which allows setting a portion
of MARC header to a certain value.
New option for yaz-marcdump -lpos=value which allows setting a portion
of MARC header to a certain value.
dnl YAZ Toolkit, Index Data 1994-2006
dnl See the file LICENSE for details.
dnl YAZ Toolkit, Index Data 1994-2006
dnl See the file LICENSE for details.
-dnl $Id: configure.ac,v 1.32 2006-08-16 22:50:06 adam Exp $
+dnl $Id: configure.ac,v 1.33 2006-08-30 12:04:42 adam Exp $
AC_PREREQ(2.59)
AC_INIT([yaz],[2.1.27],[adam@indexdata.dk])
AC_CONFIG_SRCDIR(configure.ac)
AC_PREREQ(2.59)
AC_INIT([yaz],[2.1.27],[adam@indexdata.dk])
AC_CONFIG_SRCDIR(configure.ac)
])
fi
dnl ------ various functions
])
fi
dnl ------ various functions
-AC_CHECK_FUNCS(vsnprintf gettimeofday poll strerror_r localtime_r usleep fopen64)
+AC_CHECK_FUNCS(gethostbyname_r vsnprintf gettimeofday poll strerror_r localtime_r usleep fopen64)
case $host in
*-*-darwin*)
trypoll="no";
case $host in
*-*-darwin*)
trypoll="no";
* Copyright (C) 1995-2005, Index Data ApS
* See the file LICENSE for details.
*
* Copyright (C) 1995-2005, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: tcpip.c,v 1.19 2006-08-24 13:25:45 adam Exp $
+ * $Id: tcpip.c,v 1.20 2006-08-30 12:04:43 adam Exp $
int default_port)
{
struct hostent *hp;
int default_port)
{
struct hostent *hp;
+#if HAVE_GETHOSTBYNAME_R
+ struct hostent h;
+ char hbuf[1024];
+ int h_error;
+#endif
char *p, buf[512];
short int port = default_port;
char *p, buf[512];
short int port = default_port;
if (!tcpip_init ())
return 0;
if (!tcpip_init ())
return 0;
}
add->sin_port = htons(port);
if (!strcmp("@", buf))
}
add->sin_port = htons(port);
if (!strcmp("@", buf))
add->sin_addr.s_addr = INADDR_ANY;
add->sin_addr.s_addr = INADDR_ANY;
+ }
+ else if ((tmpadd = inet_addr(buf)) != INADDR_NONE)
+ {
+ memcpy(&add->sin_addr.s_addr, &tmpadd, sizeof(struct in_addr));
+ }
+#if HAVE_GETHOSTBYNAME_R
+ else if (gethostbyname_r(buf, &h, hbuf, sizeof(hbuf), &hp, &h_error) == 0)
+ {
+ memcpy(&add->sin_addr.s_addr, *hp->h_addr_list,
+ sizeof(struct in_addr));
+ }
+#else
else if ((hp = gethostbyname(buf)))
else if ((hp = gethostbyname(buf)))
memcpy(&add->sin_addr.s_addr, *hp->h_addr_list,
sizeof(struct in_addr));
memcpy(&add->sin_addr.s_addr, *hp->h_addr_list,
sizeof(struct in_addr));
- else if ((tmpadd = (unsigned) inet_addr(buf)) != 0)
- memcpy(&add->sin_addr.s_addr, &tmpadd, sizeof(struct in_addr));