(void) ldap_initialize( &ld, ldapuri );
}
- if( ld != NULL ) {
- fprintf( stderr, "Could not create LDAP session handle (%d): %s\n", rc );
+ if( ld == NULL ) {
+ fprintf( stderr, "Could not create LDAP session handle (%d): %s\n",
+ rc, ldap_err2string(rc) );
return EXIT_FAILURE;
}