From 6e602b549420181bfe6ad55d863963a5b11544d1 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sat, 21 Jun 2003 22:55:15 +0000 Subject: [PATCH] ITS#2607: improve socket() error logging with AF info --- servers/slapd/daemon.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index 15628e1706..6db9fa7222 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -731,15 +731,21 @@ static int slap_open_listener( psal = sal; while ( *sal != NULL ) { + char *af; switch( (*sal)->sa_family ) { case AF_INET: + af = "IPv4"; + break; #ifdef LDAP_PF_INET6 case AF_INET6: + af = "IPv6"; + break; #endif #ifdef LDAP_PF_LOCAL case AF_LOCAL: -#endif + af = "Local"; break; +#endif default: sal++; continue; @@ -752,12 +758,12 @@ static int slap_open_listener( int err = sock_errno(); #ifdef NEW_LOGGING LDAP_LOG( CONNECTION, ERR, - "slap_open_listener: socket() failed errno=%d (%s)\n", - err, sock_errstr(err), 0 ); + "slap_open_listener: %s socket() failed errno=%d (%s)\n", + af, err, sock_errstr(err) ); #else Debug( LDAP_DEBUG_ANY, - "daemon: socket() failed errno=%d (%s)\n", err, - sock_errstr(err), 0 ); + "daemon: %s socket() failed errno=%d (%s)\n", + af, err, sock_errstr(err) ); #endif sal++; continue; @@ -770,8 +776,8 @@ static int slap_open_listener( "great %ld\n", (long)l.sl_sd, (long)dtblsize, 0 ); #else Debug( LDAP_DEBUG_ANY, - "daemon: listener descriptor %ld is too great %ld\n", - (long) l.sl_sd, (long) dtblsize, 0 ); + "daemon: listener descriptor %ld is too great %ld\n", + (long) l.sl_sd, (long) dtblsize, 0 ); #endif tcp_close( l.sl_sd ); sal++; @@ -788,7 +794,7 @@ static int slap_open_listener( /* enable address reuse */ tmp = 1; rc = setsockopt( l.sl_sd, SOL_SOCKET, SO_REUSEADDR, - (char *) &tmp, sizeof(tmp) ); + (char *) &tmp, sizeof(tmp) ); if ( rc == AC_SOCKET_ERROR ) { int err = sock_errno(); #ifdef NEW_LOGGING -- 2.39.5