Navigation Menu

Skip to content

Commit

Permalink
Remove conf file on remove
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Oct 18, 2015
1 parent 0f9c44e commit 7287995
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/db.c
Expand Up @@ -217,6 +217,15 @@ grn_db_conf_open(grn_ctx *ctx, grn_db *s, const char *path)
}
}

static grn_rc
grn_db_conf_remove(grn_ctx *ctx, const char *path)
{
char conf_path[PATH_MAX];

grn_snprintf(conf_path, PATH_MAX, PATH_MAX, GRN_DB_CONF_PATH_FORMAT, path);
return grn_hash_remove(ctx, conf_path);
}

grn_obj *
grn_db_create(grn_ctx *ctx, const char *path, grn_db_create_optarg *optarg)
{
Expand Down Expand Up @@ -8613,6 +8622,11 @@ _grn_obj_remove_db(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id,
rc = grn_dat_remove(ctx, path);
break;
}
if (rc == GRN_SUCCESS) {
rc = grn_db_conf_remove(ctx, path);
} else {
grn_db_conf_remove(ctx, path);
}
}

return rc;
Expand Down

0 comments on commit 7287995

Please sign in to comment.