]> git.sur5r.net Git - openldap/commitdiff
apparently, time_t is unsigned in some systems
authorPierangelo Masarati <ando@openldap.org>
Mon, 12 Mar 2007 21:04:01 +0000 (21:04 +0000)
committerPierangelo Masarati <ando@openldap.org>
Mon, 12 Mar 2007 21:04:01 +0000 (21:04 +0000)
libraries/libldap/result.c

index 994c52bad79208bca9656baf7d50dc232473478c..8983eea94e3646b5428943983a1debd97b0d6e9e 100644 (file)
@@ -423,13 +423,18 @@ wait4msg(
                }
 
                if ( rc == LDAP_MSG_X_KEEP_LOOKING && tvp != NULL ) {
+                       time_t  delta_time;
+
                        tmp_time = time( NULL );
-                       tv0.tv_sec -= ( tmp_time - start_time );
-                       if ( tv0.tv_sec <= 0 ) {
+                       delta_time = tmp_time - start_time;
+
+                       /* do not assume time_t is signed */
+                       if ( tv0.tv_sec <= delta_time ) {
                                rc = 0; /* timed out */
                                ld->ld_errno = LDAP_TIMEOUT;
                                break;
                        }
+                       tv0.tv_sec -= delta_time;
                        tv.tv_sec = tv0.tv_sec;
 
                        Debug( LDAP_DEBUG_TRACE, "wait4msg ld %p %ld secs to go\n",