From: Pierangelo Masarati Date: Mon, 12 Mar 2007 21:04:28 +0000 (+0000) Subject: apparently, time_t is unsigned in some systems X-Git-Tag: OPENLDAP_REL_ENG_2_3_35~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1616a6205ee3114340ca5925684a8f6fa8a8e27f;p=thirdparty%2Fopenldap.git apparently, time_t is unsigned in some systems --- diff --git a/CHANGES b/CHANGES index 6eea3066fd..83ce180bd7 100644 --- a/CHANGES +++ b/CHANGES @@ -9,6 +9,7 @@ OpenLDAP 2.3.35 Engineering Fixed slapd-meta/slapo-rwm filter mapping Fixed slapd-sql subtree shortcut (ITS#4856) Fixed slapo-refint config message (ITS#4853) + Fixed libldap time_t signedness Fixed libldap_r tpool reset (ITS#4855) OpenLDAP 2.3.34 Release (2007/02/16) diff --git a/libraries/libldap/result.c b/libraries/libldap/result.c index f6f917959a..3dea734fa7 100644 --- a/libraries/libldap/result.c +++ b/libraries/libldap/result.c @@ -369,13 +369,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",