]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/result.c
ITS#8625 Separate Avlnode and TAvlnode types
[openldap] / libraries / libldap / result.c
index d293299e2a4433d281f6e0b677d2f5ae1374fc58..fba8ff4397ab020adc3927325c6816a716ed4d9f 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2013 The OpenLDAP Foundation.
+ * Copyright 1998-2017 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -113,6 +113,9 @@ ldap_result(
 
        Debug( LDAP_DEBUG_TRACE, "ldap_result ld %p msgid %d\n", (void *)ld, msgid, 0 );
 
+       if (ld->ld_errno == LDAP_LOCAL_ERROR || ld->ld_errno == LDAP_SERVER_DOWN)
+               return -1;
+
        LDAP_MUTEX_LOCK( &ld->ld_res_mutex );
        rc = wait4msg( ld, msgid, all, timeout, result );
        LDAP_MUTEX_UNLOCK( &ld->ld_res_mutex );
@@ -273,7 +276,7 @@ wait4msg(
 #ifdef HAVE_GETTIMEOFDAY
                gettimeofday( &start_time_tv, NULL );
 #else /* ! HAVE_GETTIMEOFDAY */
-               time( &start_time_tv.tv_sec );
+               start_time_tv.tv_sec = time( NULL );
                start_time_tv.tv_usec = 0;
 #endif /* ! HAVE_GETTIMEOFDAY */
        }
@@ -387,7 +390,7 @@ wait4msg(
 #ifdef HAVE_GETTIMEOFDAY
                        gettimeofday( &curr_time_tv, NULL );
 #else /* ! HAVE_GETTIMEOFDAY */
-                       time( &curr_time_tv.tv_sec );
+                       curr_time_tv.tv_sec = time( NULL );
                        curr_time_tv.tv_usec = 0;
 #endif /* ! HAVE_GETTIMEOFDAY */