Fixed in slurpd and the slapd main dir. Slapd clients were not examined.
It also "felt right" to swap the order of closing dfp and rfp in slurpd
copy_replog(), so the last acquired lock is unlocked first.
#else
lockf( fileno( *lfp ), F_ULOCK, 0 );
#endif
+ fclose( *lfp );
+ *lfp = NULL;
return( NULL );
}
Debug( LDAP_DEBUG_ANY,
"error: can't seek to offset %ld in file \"%s\"\n",
sglob->srpos, f, 0 );
- return;
- }
+ } else {
while (( p = get_record( fp )) != NULL ) {
if ( sglob->rq->rq_add( sglob->rq, p ) < 0 ) {
char *t;
pthread_yield();
}
sglob->srpos = ftell( fp );
+ }
(void) relinquish_lock( f, fp, lfp );
}
#else
lockf( fileno( *lfp ), F_ULOCK, 0 );
#endif
+ fclose( *lfp );
+ *lfp = NULL;
return( NULL );
}
Debug( LDAP_DEBUG_ANY,
"Error: copy_replog: Can't lock replog \"%s\" for write: %s\n",
src, sys_errlist[ errno ], 0 );
- lock_fclose( rfp );
+ lock_fclose( rfp, lfp );
return( 1 );
}
truncate( src, (off_t) 0 );
}
- if ( lock_fclose( rfp, lfp ) == EOF ) {
+ if ( lock_fclose( dfp, dlfp ) == EOF ) {
Debug( LDAP_DEBUG_ANY,
"Error: copy_replog: Error closing \"%s\"\n",
src, 0, 0 );
}
- if ( lock_fclose( dfp, dlfp ) == EOF ) {
+ if ( lock_fclose( rfp, lfp ) == EOF ) {
Debug( LDAP_DEBUG_ANY,
"Error: copy_replog: Error closing \"%s\"\n",
src, 0, 0 );
while ( !sglob->slurpd_shutdown &&
((new_re = re->re_getnext( re )) == NULL )) {
if ( sglob->one_shot_mode ) {
+ rq->rq_unlock( rq );
return 0;
}
/* No work - wait on condition variable */
return 0;
}
if (( rc = acquire_lock( sglob->slurpd_status_file, &fp, &lfp)) < 0 ) {
+ pthread_mutex_unlock( &(st->st_mutex ));
return 0;
}
while ( fgets( buf, sizeof( buf ), fp ) != NULL ) {