- strcpy(buf, config.db_dir);
- strcat(buf, "/keydb.db");
-
- ret = db_create(&dbconn, NULL, 0);
+ ret = db_env_create(&dbenv, 0);
+ if (ret != 0) {
+ fprintf(stderr, "db_env_create: %s\n", db_strerror(ret));
+ exit(1);
+ }
+
+ ret = dbenv->open(dbenv, config.db_dir,
+ DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_LOCK |
+ DB_INIT_TXN |
+ DB_RECOVER | DB_CREATE,
+ 0);
+ if (ret != 0) {
+ dbenv->err(dbenv, ret, "%s", config.db_dir);
+ exit(1);
+ }
+
+ ret = db_create(&dbconn, dbenv, 0);