]> git.sur5r.net Git - openldap/blobdiff - clients/ud/mod.c
Don't depend error handling on exact resultCode.
[openldap] / clients / ud / mod.c
index 40eea363167aad250e3a5e6b9102e1c11d330b93..a955b17161a42b375ec3dbb357e4971e39771bad 100644 (file)
@@ -1,4 +1,8 @@
 /* $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.
@@ -784,23 +788,22 @@ check_URL( char *url )
 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" );
 }