]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/error.c
ITS#399: timelimit/timeout handling
[openldap] / libraries / libldap / error.c
index 316bbaa8ed1f5c4347b1d746c499bcfc0ef139af..d1fefd66dfe3b0506b53e679829bc77987dd4027 100644 (file)
@@ -160,6 +160,7 @@ ldap_perror( LDAP *ld, LDAP_CONST char *str )
        fflush( stderr );
 }
 
+/* deprecated */
 int
 ldap_result2error( LDAP *ld, LDAPMessage *r, int freeit )
 {
@@ -168,7 +169,7 @@ ldap_result2error( LDAP *ld, LDAPMessage *r, int freeit )
        rc = ldap_parse_result( ld, r, &err,
                NULL, NULL, NULL, NULL, freeit );
 
-       return rc != LDAP_SUCCESS ? rc : err;
+       return err != LDAP_SUCCESS ? err : rc;
 }
 
 /*
@@ -324,10 +325,10 @@ ldap_parse_result(
        }
 
        /* return */
+       if( errcodep != NULL ) {
+               *errcodep = ld->ld_errno;
+       }
        if ( errcode == LDAP_SUCCESS ) {
-               if( errcodep != NULL ) {
-                       *errcodep = ld->ld_errno;
-               }
                if( matcheddnp != NULL ) {
                        *matcheddnp = LDAP_STRDUP( ld->ld_matched );
                }