diff --git a/src/reindex.c b/src/reindex.c index 109ada85..233926f8 100644 --- a/src/reindex.c +++ b/src/reindex.c @@ -222,6 +222,13 @@ int main(int argc, char **argv){ initrules(data.archiving_rules); initrules(data.retention_rules); + init_session_data(&sdata, &cfg); + + + if(open_database(&sdata, &cfg) == ERR){ + p_clean_exit("cannot connect to mysql server", 1); + } + if(folder){ data.folder = get_folder_id(&sdata, &data, folder, 0); if(data.folder == 0){ @@ -230,13 +237,6 @@ int main(int argc, char **argv){ } } - init_session_data(&sdata, &cfg); - - - if(open_database(&sdata, &cfg) == ERR){ - p_clean_exit("cannot connect to mysql server", 1); - } - load_mydomains(&sdata, &data, &cfg);