From be14ac9fed9298303ea986ead3cd207ce5525d61 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Thu, 10 Nov 2005 03:23:04 +0000 Subject: [PATCH] Add error number to tool_perror() output Don't hardcode function name. --- clients/tools/common.c | 7 ++++--- clients/tools/common.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/clients/tools/common.c b/clients/tools/common.c index eb6f9869db..1729d492df 100644 --- a/clients/tools/common.c +++ b/clients/tools/common.c @@ -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 ); diff --git a/clients/tools/common.h b/clients/tools/common.h index 3e581f27ae..a0ce71c569 100644 --- a/clients/tools/common.h +++ b/clients/tools/common.h @@ -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, -- 2.39.5