mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
ITS#2607: improve socket() error logging with AF info
This commit is contained in:
parent
89ab17fe71
commit
6e602b5494
@ -731,15 +731,21 @@ static int slap_open_listener(
|
|||||||
|
|
||||||
psal = sal;
|
psal = sal;
|
||||||
while ( *sal != NULL ) {
|
while ( *sal != NULL ) {
|
||||||
|
char *af;
|
||||||
switch( (*sal)->sa_family ) {
|
switch( (*sal)->sa_family ) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
|
af = "IPv4";
|
||||||
|
break;
|
||||||
#ifdef LDAP_PF_INET6
|
#ifdef LDAP_PF_INET6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
|
af = "IPv6";
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef LDAP_PF_LOCAL
|
#ifdef LDAP_PF_LOCAL
|
||||||
case AF_LOCAL:
|
case AF_LOCAL:
|
||||||
#endif
|
af = "Local";
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
sal++;
|
sal++;
|
||||||
continue;
|
continue;
|
||||||
@ -752,12 +758,12 @@ static int slap_open_listener(
|
|||||||
int err = sock_errno();
|
int err = sock_errno();
|
||||||
#ifdef NEW_LOGGING
|
#ifdef NEW_LOGGING
|
||||||
LDAP_LOG( CONNECTION, ERR,
|
LDAP_LOG( CONNECTION, ERR,
|
||||||
"slap_open_listener: socket() failed errno=%d (%s)\n",
|
"slap_open_listener: %s socket() failed errno=%d (%s)\n",
|
||||||
err, sock_errstr(err), 0 );
|
af, err, sock_errstr(err) );
|
||||||
#else
|
#else
|
||||||
Debug( LDAP_DEBUG_ANY,
|
Debug( LDAP_DEBUG_ANY,
|
||||||
"daemon: socket() failed errno=%d (%s)\n", err,
|
"daemon: %s socket() failed errno=%d (%s)\n",
|
||||||
sock_errstr(err), 0 );
|
af, err, sock_errstr(err) );
|
||||||
#endif
|
#endif
|
||||||
sal++;
|
sal++;
|
||||||
continue;
|
continue;
|
||||||
@ -770,8 +776,8 @@ static int slap_open_listener(
|
|||||||
"great %ld\n", (long)l.sl_sd, (long)dtblsize, 0 );
|
"great %ld\n", (long)l.sl_sd, (long)dtblsize, 0 );
|
||||||
#else
|
#else
|
||||||
Debug( LDAP_DEBUG_ANY,
|
Debug( LDAP_DEBUG_ANY,
|
||||||
"daemon: listener descriptor %ld is too great %ld\n",
|
"daemon: listener descriptor %ld is too great %ld\n",
|
||||||
(long) l.sl_sd, (long) dtblsize, 0 );
|
(long) l.sl_sd, (long) dtblsize, 0 );
|
||||||
#endif
|
#endif
|
||||||
tcp_close( l.sl_sd );
|
tcp_close( l.sl_sd );
|
||||||
sal++;
|
sal++;
|
||||||
@ -788,7 +794,7 @@ static int slap_open_listener(
|
|||||||
/* enable address reuse */
|
/* enable address reuse */
|
||||||
tmp = 1;
|
tmp = 1;
|
||||||
rc = setsockopt( l.sl_sd, SOL_SOCKET, SO_REUSEADDR,
|
rc = setsockopt( l.sl_sd, SOL_SOCKET, SO_REUSEADDR,
|
||||||
(char *) &tmp, sizeof(tmp) );
|
(char *) &tmp, sizeof(tmp) );
|
||||||
if ( rc == AC_SOCKET_ERROR ) {
|
if ( rc == AC_SOCKET_ERROR ) {
|
||||||
int err = sock_errno();
|
int err = sock_errno();
|
||||||
#ifdef NEW_LOGGING
|
#ifdef NEW_LOGGING
|
||||||
|
Loading…
Reference in New Issue
Block a user