Import patches mistakenly applied to OPENLDAP_DEVEL_REFERRALS.

ldap_modify: delete of last attribute value should delete attribute (ITS#229)
thr_nt: use sleep to yield
This commit is contained in:
Kurt Zeilenga 1999-07-18 00:33:30 +00:00
parent f92d01c2bb
commit 12f481d657
3 changed files with 23 additions and 0 deletions

View file

@ -65,6 +65,7 @@ ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo )
int
ldap_pvt_thread_yield( void )
{
Sleep( 0 );
return 0;
}

View file

@ -355,6 +355,17 @@ bdb2i_delete_values(
a->a_vals[k - 1] = a->a_vals[k];
}
a->a_vals[k - 1] = NULL;
/* delete the entire attribute, if no values remain */
if ( a->a_vals[0] == NULL) {
Debug( LDAP_DEBUG_ARGS,
"removing entire attribute %s\n",
mod->mod_type, 0, 0 );
if ( attr_delete( &e->e_attrs, mod->mod_type ) ) {
return LDAP_NO_SUCH_ATTRIBUTE;
}
}
break;
}

View file

@ -367,6 +367,17 @@ delete_values(
a->a_vals[k - 1] = a->a_vals[k];
}
a->a_vals[k - 1] = NULL;
/* delete the entire attribute, if no values remain */
if ( a->a_vals[0] == NULL) {
Debug( LDAP_DEBUG_ARGS,
"removing entire attribute %s\n",
mod->mod_type, 0, 0 );
if ( attr_delete( &e->e_attrs, mod->mod_type ) ) {
return LDAP_NO_SUCH_ATTRIBUTE;
}
}
break;
}