int lcb_clconfig_file_set_filename(clconfig_provider *p, const char *f, int ro) { file_provider *provider = (file_provider *)p; lcb_assert(provider->base.type == LCB_CLCONFIG_FILE); provider->base.enabled = 1; if (provider->filename) { free(provider->filename); } provider->filename = mkcachefile(f, p->parent->settings->bucket); if (ro) { FILE *fp_tmp; provider->ro_mode = 1; fp_tmp = fopen(provider->filename, "r"); if (!fp_tmp) { lcb_log(LOGARGS(provider, ERROR), LOGFMT "Couldn't open for reading: %s", LOGID(provider), strerror(errno)); return -1; } else { fclose(fp_tmp); } } return 0; }
int lcb_clconfig_file_set_filename(clconfig_provider *p, const char *f) { file_provider *provider = (file_provider *)p; lcb_assert(provider->base.type == LCB_CLCONFIG_FILE); provider->base.enabled = 1; if (provider->filename) { free(provider->filename); } provider->filename = mkcachefile(f, p->parent->settings->bucket); return 0; }