]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/tools/ldbmtest.c
Import minor trace output cleanup
[openldap] / servers / slapd / tools / ldbmtest.c
index 99fdee67c80bce435d58485e4e2cb45631a72d43..ba3fc163e92c50d71d5dbbd626c775cc9f6105a8 100644 (file)
@@ -31,29 +31,9 @@ static void          free_and_close(struct dbcache *dbc, Datum key, Datum data);
 static void            edit_entry(char c, Datum *data);
 static void            get_keydata(FILE *fp, char c, Datum *key, Datum *data);
 
-struct dbcache *dbc;
-LDBM           dbp;
-char           *tailorfile;
-Backend                *be = NULL;
-int            ldap_debug;
-int            ldap_syslog;
-int            ldap_syslog_level;
-int            global_schemacheck;
-long           num_entries_sent;
-long           num_bytes_sent;
-int            active_threads;
-char           *default_referral;
-struct objclass        *global_oc;
-time_t         currenttime;
-pthread_t      listener_tid;
-pthread_mutex_t        num_sent_mutex;
-pthread_mutex_t        entry2str_mutex;
-pthread_mutex_t        active_threads_mutex;
-pthread_mutex_t        new_conn_mutex;
-pthread_mutex_t        currenttime_mutex;
-pthread_mutex_t        replog_mutex;
-pthread_mutex_t        ops_mutex;
-pthread_mutex_t        regex_mutex;
+static struct dbcache *dbc;
+static LDBM           dbp;
+static Backend         *be = NULL;
 
 int
 main( int argc, char **argv )
@@ -65,11 +45,17 @@ main( int argc, char **argv )
        IDList          *idl;
        Backend         *tbe;
        int             i;
+       char            *tailorfile;
 
 #ifdef HAVE_BERKELEY_DB2
        DBC     *cursorp;
 #endif
 
+       ldbm_datum_init( savekey );
+       ldbm_datum_init( key );
+       ldbm_datum_init( data );
+       ldbm_datum_init( last );
+
        tailorfile = SLAPD_DEFAULT_CONFIGFILE;
        while ( (i = getopt( argc, argv, "d:f:" )) != EOF ) {
                switch ( i ) {
@@ -181,7 +167,9 @@ main( int argc, char **argv )
                                            "key: ", NULL, NULL );
                                }
 
-                               ldbm_datum_free( dbc->dbc_db, data );
+                if ( data.dptr != NULL ) {
+                                   ldbm_datum_free( dbc->dbc_db, data );
+                }
                        }
                        if ( savekey.dptr != NULL )
                                ldbm_datum_free( dbc->dbc_db, savekey );
@@ -559,7 +547,9 @@ edit_entry( char c, Datum *data )
                perror( tmpname );
                return;
        }
-       ldbm_datum_free( NULL, *data );
+    if ( data->dptr != NULL ) {
+           ldbm_datum_free( NULL, *data );
+    }
        get_keydata( fp, c, NULL, data );
        fclose( fp );
        unlink( tmpname );