Commit 68ffed71 authored by Howard Chu's avatar Howard Chu
Browse files

Additional fix for threaded slapadd

If slapadd'ing a config DB and tool-threads is set in the config LDIF,
the checks for slap_tool_thread_max will be invalid.
parent 74e8e398
...@@ -302,11 +302,13 @@ getrec_thr(void *ctx) ...@@ -302,11 +302,13 @@ getrec_thr(void *ctx)
return NULL; return NULL;
} }
static int ldif_threaded;
static int static int
getrec(Erec *erec) getrec(Erec *erec)
{ {
int rc; int rc;
if ( slap_tool_thread_max < 2 ) if ( !ldif_threaded )
return getrec0(erec); return getrec0(erec);
while (!trec.ready) while (!trec.ready)
...@@ -405,6 +407,7 @@ slapadd( int argc, char **argv ) ...@@ -405,6 +407,7 @@ slapadd( int argc, char **argv )
ldap_pvt_thread_mutex_init( &add_mutex ); ldap_pvt_thread_mutex_init( &add_mutex );
ldap_pvt_thread_cond_init( &add_cond ); ldap_pvt_thread_cond_init( &add_cond );
ldap_pvt_thread_create( &thr, 0, getrec_thr, NULL ); ldap_pvt_thread_create( &thr, 0, getrec_thr, NULL );
ldif_threaded = 1;
} }
erec.nextline = 0; erec.nextline = 0;
...@@ -452,7 +455,7 @@ slapadd( int argc, char **argv ) ...@@ -452,7 +455,7 @@ slapadd( int argc, char **argv )
prev = erec.e; prev = erec.e;
} }
if ( slap_tool_thread_max > 1 ) { if ( ldif_threaded ) {
ldap_pvt_thread_mutex_lock( &add_mutex ); ldap_pvt_thread_mutex_lock( &add_mutex );
add_stop = 1; add_stop = 1;
trec.ready = 0; trec.ready = 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment