Add error number to tool_perror() output

Don't hardcode function name.
This commit is contained in:
Kurt Zeilenga 2005-11-10 03:23:04 +00:00
parent 4537065ffc
commit be14ac9fed
2 changed files with 5 additions and 3 deletions

View File

@ -189,14 +189,15 @@ NULL
}
void tool_perror(
char *func,
int err,
char *extra,
char *matched,
char *info,
char **refs )
{
fprintf( stderr, "ldap_bind: %s%s\n",
ldap_err2string( err ), extra ? extra : "" );
fprintf( stderr, "%s: %s (%d)%s\n",
func, ldap_err2string( err ), err, extra ? extra : "" );
if ( matched && *matched ) {
fprintf( stderr, _("\tmatched DN: %s\n"), matched );
@ -1023,7 +1024,7 @@ tool_bind( LDAP *ld )
|| ( info && info[ 0 ] )
|| refs )
{
tool_perror( err, msgbuf, matched, info, refs );
tool_perror( "ldap_bind", err, msgbuf, matched, info, refs );
if( matched ) ber_memfree( matched );
if( info ) ber_memfree( info );

View File

@ -83,6 +83,7 @@ void tool_destroy LDAP_P(( void ));
void tool_server_controls LDAP_P(( LDAP *, LDAPControl *, int ));
int tool_check_abandon LDAP_P(( LDAP *ld, int msgid ));
void tool_perror LDAP_P((
char *func,
int err,
char *extra,
char *matched,