};
int ret = kr_cache_open(&engine->resolver.cache, api, &opts, engine->pool);
if (ret != 0) {
- format_error(L, "can't open cache");
- lua_error(L);
+ char cwd[PATH_MAX];
+ if(getcwd(cwd, sizeof(cwd)) == NULL) {
+ const char errprefix[] = "<invalid working directory>";
+ strncpy(cwd, errprefix, sizeof(cwd));
+ }
+ return luaL_error(L, "can't open cache path '%s'; working directory '%s'", opts.path, cwd);
}
/* Store current configuration */
/* Version doesn't match. Recreate cache and write version key. */
ret = cache_op(cache, count);
if (ret != 0) { /* Non-empty cache, purge it. */
- kr_log_info("[cache] purging cache\n");
+ kr_log_info("[cache] incompatible cache database detected, purging\n");
ret = cache_purge(cache);
}
/* Either purged or empty. */
case ENOSPC:
return kr_error(ENOSPC);
default:
+ kr_log_info("[cache] LMDB error: %s\n", mdb_strerror(error));
return -abs(error);
}
}
auto_free char *lockfile = kr_strcatdup(2, opts->path, "/.cachelock");
if (lockfile) {
if (unlink(lockfile) == 0) {
- kr_log_info("[system] cache: cleared stale lockfile '%s'\n", lockfile);
+ kr_log_info("[cache] cleared stale lockfile '%s'\n", lockfile);
} else if (errno != ENOENT) {
- kr_log_info("[system] cache: failed to clear stale lockfile '%s': %s\n", lockfile,
+ kr_log_info("[cache] failed to clear stale lockfile '%s': %s\n", lockfile,
strerror(errno));
}
}