From 7549abb0636478616796737761ea481827e74115 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 27 Feb 2009 01:31:31 +0000 Subject: [PATCH] Better fix for prev --- servers/slapd/back-ldap/search.c | 5 ++--- servers/slapd/back-meta/search.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/servers/slapd/back-ldap/search.c b/servers/slapd/back-ldap/search.c index 2539706e19..27e08e39eb 100644 --- a/servers/slapd/back-ldap/search.c +++ b/servers/slapd/back-ldap/search.c @@ -819,10 +819,8 @@ ldap_build_entry( if ( attr->a_desc->ad_type->sat_flags & SLAP_AT_SORTED_VAL ) { while ( attr->a_numvals > 1 ) { int rc = slap_sort_vals( (Modifications *)attr, &text, &i, op->o_tmpmemctx ); - if ( rc != LDAP_TYPE_OR_VALUE_EXISTS ) { - attr->a_flags |= SLAP_ATTR_SORTED_VALS; + if ( rc != LDAP_TYPE_OR_VALUE_EXISTS ) break; - } /* Strip duplicate values */ if ( attr->a_nvals != attr->a_vals ) @@ -838,6 +836,7 @@ ldap_build_entry( if ( attr->a_nvals != attr->a_vals ) BER_BVZERO(&attr->a_vals[attr->a_numvals]); } + attr->a_flags |= SLAP_ATTR_SORTED_VALS; } *attrp = attr; diff --git a/servers/slapd/back-meta/search.c b/servers/slapd/back-meta/search.c index 180cd7788e..b0de33851d 100644 --- a/servers/slapd/back-meta/search.c +++ b/servers/slapd/back-meta/search.c @@ -2168,10 +2168,8 @@ next_attr:; while ( attr->a_numvals > 1 ) { int i; int rc = slap_sort_vals( (Modifications *)attr, &text, &i, op->o_tmpmemctx ); - if ( rc != LDAP_TYPE_OR_VALUE_EXISTS ) { - attr->a_flags |= SLAP_ATTR_SORTED_VALS; + if ( rc != LDAP_TYPE_OR_VALUE_EXISTS ) break; - } /* Strip duplicate values */ if ( attr->a_nvals != attr->a_vals ) @@ -2187,6 +2185,7 @@ next_attr:; if ( attr->a_nvals != attr->a_vals ) BER_BVZERO(&attr->a_vals[attr->a_numvals]); } + attr->a_flags |= SLAP_ATTR_SORTED_VALS; } } } -- 2.39.5