- if (!dblist[1].name)
- goto dopey;
- if (conf.dbtool_given) {
- for (i = 0; dblist[i].name; i++) {
- if (strcmp(dblist[i].name, conf.dbtool_arg))
- continue;
- PARA_NOTICE_LOG("initializing %s database tool\n",
- dblist[i].name);
- if (dblist[i].init(&dblist[i]) < 0) {
- PARA_WARNING_LOG("init %s failed",
- dblist[i].name);
- goto dopey;
- }
- mmd->dbt_num = i;
- return;
- }
- PARA_WARNING_LOG("%s", "no such dbtool, switching to dopey\n");
- goto dopey;
- }
- /* use the first dbtool that works
- * (assuming that dopey always works)
- */
- for (i = 1; dblist[i].name; i++) {
- int ret = dblist[i].init(&dblist[i]);
- if (ret >= 0) {
- PARA_INFO_LOG("initialized %s\n", dblist[i].name);
- mmd->dbt_num = i;
- return;
+ if (!conf.dbtool_given)
+ goto random;
+ for (i = 0; dblist[i].name; i++) {
+ if (strcmp(dblist[i].name, conf.dbtool_arg))
+ continue;
+ PARA_NOTICE_LOG("initializing %s database tool\n",
+ dblist[i].name);
+ ret = dblist[i].init(&dblist[i]);
+ if (ret < 0) {
+ PARA_WARNING_LOG("%s", PARA_STRERROR(-ret));
+ break;