mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-02-02 03:49:34 -05:00
Updated string error handling
This commit is contained in:
parent
659b41ec7d
commit
ba749eb798
2 changed files with 11 additions and 4 deletions
|
|
@ -103,11 +103,12 @@ ldap_pvt_close_socket(LDAP *ld, int s)
|
|||
|
||||
#undef TRACE
|
||||
#define TRACE do { \
|
||||
char ebuf[128]; \
|
||||
oslocal_debug(ld, \
|
||||
"ldap_is_socket_ready: errror on socket %d: errno: %d (%s)\n", \
|
||||
s, \
|
||||
errno, \
|
||||
STRERROR(errno) ); \
|
||||
AC_STRERROR_R(errno, ebuf, sizeof ebuf)); \
|
||||
} while( 0 )
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -43,6 +43,12 @@
|
|||
extern int h_errno;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_HSTRERROR
|
||||
# define HSTRERROR(e) hstrerror(e)
|
||||
#else
|
||||
# define HSTRERROR(e) hp_strerror(e)
|
||||
#endif
|
||||
|
||||
#ifndef LDAP_R_COMPILE
|
||||
# undef HAVE_REENTRANT_FUNCTIONS
|
||||
# undef HAVE_CTIME_R
|
||||
|
|
@ -189,7 +195,7 @@ int ldap_pvt_gethostbyname_a(
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifndef GETNAMEINFO
|
||||
#if !defined( GETNAMEINFO ) && !defined( HAVE_HERROR )
|
||||
static const char *
|
||||
hp_strerror( int err )
|
||||
{
|
||||
|
|
@ -249,7 +255,7 @@ int ldap_pvt_get_hname(
|
|||
alen = sizeof(sin->sin_addr);
|
||||
} else {
|
||||
rc = NO_RECOVERY;
|
||||
*err = (char *)hp_strerror( rc );
|
||||
*err = (char *)HSTRERROR( rc );
|
||||
return rc;
|
||||
}
|
||||
#if defined( HAVE_GETHOSTBYADDR_R )
|
||||
|
|
@ -281,7 +287,7 @@ int ldap_pvt_get_hname(
|
|||
if (hp) {
|
||||
strncpy( name, hp->h_name, namelen );
|
||||
} else {
|
||||
*err = (char *)hp_strerror( h_errno );
|
||||
*err = (char *)HSTRERROR( h_errno );
|
||||
}
|
||||
LDAP_FREE(buf);
|
||||
#else /* HAVE_GETHOSTBYADDR_R */
|
||||
|
|
|
|||
Loading…
Reference in a new issue