]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/result.c
Rework counter code in fallback.
[openldap] / libraries / libldap / result.c
index 8b03df7697467b60834a69e9bf494f154526892f..a47e0577e97b557058ea13bbcf557a01f6b94564 100644 (file)
@@ -1,3 +1,4 @@
+/* $OpenLDAP$ */
 /*
  * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
@@ -340,7 +341,7 @@ try_read1msg(
        if (( lr = ldap_find_request_by_msgid( ld, id )) == NULL ) {
                Debug( LDAP_DEBUG_ANY,
                    "no request for response with msgid %ld (tossing)\n",
-                   id, 0, 0 );
+                   (long) id, 0, 0 );
                ber_free( ber, 1 );
                return( -2 );   /* continue looking */
        }
@@ -352,10 +353,10 @@ try_read1msg(
                return( -1 );
        }
 
-       Debug( LDAP_DEBUG_TRACE, "ldap_read: %s msgid %ld, original id %d\n",
+       Debug( LDAP_DEBUG_TRACE, "ldap_read: %s msgid %ld, original id %ld\n",
            ( tag == LDAP_RES_SEARCH_ENTRY ) ? "entry" : 
                ( tag == LDAP_RES_SEARCH_REFERENCE ) ? "reference" : "result",
-               id, lr->lr_origid );
+               (long) id, (long) lr->lr_origid );
 
        id = lr->lr_origid;
        refer_cnt = 0;
@@ -428,7 +429,7 @@ Debug( LDAP_DEBUG_TRACE,
                                id = lr->lr_msgid;
                                tag = lr->lr_res_msgtype;
                                Debug( LDAP_DEBUG_ANY, "request %ld done\n",
-                                   id, 0, 0 );
+                                   (long) id, 0, 0 );
 Debug( LDAP_DEBUG_TRACE,
 "res_errno: %d, res_error: <%s>, res_matched: <%s>\n",
 lr->lr_res_errno, lr->lr_res_error ? lr->lr_res_error : "",
@@ -510,8 +511,8 @@ lr->lr_res_matched ? lr->lr_res_matched : "" );
                return( -2 );   /* continue looking */
        }
 
-       Debug( LDAP_DEBUG_TRACE, "adding response id %d type %d:\n",
-           new->lm_msgid, new->lm_msgtype, 0 );
+       Debug( LDAP_DEBUG_TRACE, "adding response id %ld type %ld:\n",
+           (long) new->lm_msgid, (long) new->lm_msgtype, 0 );
 
        /* part of a search response - add to end of list of entries */
        for ( tmp = l; tmp->lm_chain != NULL &&
@@ -762,7 +763,14 @@ cldap_getmsg( LDAP *ld, struct timeval *timeout, BerElement *ber )
        ber_len_t       len;
 
        if ( ! ber_pvt_sb_data_ready(&ld->ld_sb) ) {
-               rc = ldap_select1( ld, timeout );
+               /* restored from ldap_select1() in result.c version 1.24 */
+               fd_set  readfds;
+               if ( ldap_int_tblsize == 0 )
+                       ldap_int_ip_init();
+               FD_ZERO( &readfds );
+               FD_SET( ber_pvt_sb_get_desc(&ld->ld_sb), &readfds );
+               rc = select( ldap_int_tblsize, &readfds, 0, 0, timeout );
+
                if ( rc == -1 || rc == 0 ) {
                        ld->ld_errno = (rc == -1 ? LDAP_SERVER_DOWN :
                            LDAP_TIMEOUT);