From 123668e2410e6644c5054885a05c0d1c9c717bb8 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 21 Jan 2005 22:27:24 +0000 Subject: [PATCH] More fixes for prev commit --- servers/slapd/slapadd.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/servers/slapd/slapadd.c b/servers/slapd/slapadd.c index dfe5ee1037..4b2223f3c7 100644 --- a/servers/slapd/slapadd.c +++ b/servers/slapd/slapadd.c @@ -57,11 +57,10 @@ static void *do_put(void *ptr) Entry *e; int lineno; + ldap_pvt_thread_mutex_lock( &put_mutex ); do { - ldap_pvt_thread_mutex_lock( &put_mutex ); ldap_pvt_thread_cond_wait( &put_cond, &put_mutex ); if ( put_rc ) { - ldap_pvt_thread_mutex_unlock( &put_mutex ); break; } @@ -77,7 +76,6 @@ static void *do_put(void *ptr) entry_free( e ); if ( continuemode ) continue; put_rc = EXIT_FAILURE; - ldap_pvt_thread_mutex_unlock( &put_mutex ); break; } } @@ -93,9 +91,9 @@ static void *do_put(void *ptr) } entry_free( e ); - ldap_pvt_thread_mutex_unlock( &put_mutex ); } while (1); + ldap_pvt_thread_mutex_unlock( &put_mutex ); } int @@ -401,10 +399,12 @@ slapadd( int argc, char **argv ) } if ( use_thread ) { - put_rc = EXIT_FAILURE; - ldap_pvt_thread_mutex_lock( &put_mutex ); - ldap_pvt_thread_cond_signal( &put_cond ); - ldap_pvt_thread_mutex_unlock( &put_mutex ); + if ( !put_rc ) { + put_rc = EXIT_FAILURE; + ldap_pvt_thread_mutex_lock( &put_mutex ); + ldap_pvt_thread_cond_signal( &put_cond ); + ldap_pvt_thread_mutex_unlock( &put_mutex ); + } ldap_pvt_thread_join( put_tid, NULL ); } @@ -412,7 +412,7 @@ slapadd( int argc, char **argv ) bvtext.bv_val = textbuf; bvtext.bv_val[0] = '\0'; - if ( update_ctxcsn && !dryrun && maxcsn.bv_len ) { + if ( rc == EXIT_SUCCESS && update_ctxcsn && !dryrun && maxcsn.bv_len ) { ctxcsn_id = be->be_dn2id_get( be, be->be_nsuffix ); if ( ctxcsn_id == NOID ) { fprintf( stderr, "%s: context entry is missing\n", progname ); -- 2.39.5