+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
/*
* Copyright (c) 1991,1993 Regents of the University of Michigan.
* All rights reserved.
void
mod_perror( LDAP *ld )
{
- int ld_errno = 0;
+ int ld_errno = LDAP_SUCCESS;
+ char *ld_errtext = NULL;
- if(ld != NULL) {
- ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
- }
+ ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno );
- if (( ld == NULL ) || ( ld_errno != LDAP_UNAVAILABLE &&
- ld_errno != LDAP_UNWILLING_TO_PERFORM ))
- {
- ldap_perror( ld, "modify" );
- return;
- }
+ if( ld_errno != LDAP_SUCCESS ) {
+ ldap_get_option(ld, LDAP_OPT_ERROR_STRING, &ld_errtext );
+ }
+
+ fprintf( stderr, " modify failed: %s (%d)\n",
+ ldap_err2string( ld_errno ), ld_errno );
- fprintf( stderr, "\n modify: failed because part of the online directory is not able\n" );
- fprintf( stderr, " to be modified right now" );
- if ( ld_errno == LDAP_UNAVAILABLE ) {
- fprintf( stderr, " or is temporarily unavailable" );
+ if( ld_errtext != NULL ) {
+ fprintf( stderr, " additional information: %s\n",
+ ld_errtext );
}
- fprintf( stderr, ".\n Please try again later.\n" );
+
+ fprintf( stderr, " Please try again later.\n" );
}