mirror of
https://github.com/AuxXxilium/kmod.git
synced 2024-12-27 05:49:52 +07:00
Log and break early if index is already open
This commit is contained in:
parent
be5a6deaea
commit
3e67676617
@ -615,26 +615,29 @@ KMOD_EXPORT int kmod_load_resources(struct kmod_ctx *ctx)
|
||||
return -ENOENT;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(index_files); i++) {
|
||||
const char *fn = index_files[i];
|
||||
size_t fnlen = strlen(fn);
|
||||
const char *prefix = "";
|
||||
const char *suffix = "";
|
||||
|
||||
if (ctx->indexes[i] == NULL) {
|
||||
const char *fn = index_files[i];
|
||||
size_t fnlen = strlen(fn);
|
||||
const char *prefix = "";
|
||||
const char *suffix = "";
|
||||
|
||||
if (fn[0] != '/')
|
||||
prefix = ctx->dirname;
|
||||
|
||||
if (fnlen < 4 || !streq(fn + fnlen - 4, ".bin"))
|
||||
suffix = ".bin";
|
||||
|
||||
snprintf(path, sizeof(path), "%s/%s%s",
|
||||
prefix, fn, suffix);
|
||||
fn = path;
|
||||
|
||||
ctx->indexes[i] = index_mm_open(ctx, fn, true);
|
||||
if (ctx->indexes[i] == NULL)
|
||||
goto fail;
|
||||
INFO(ctx, "Index %s already loaded\n", fn);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (fn[0] != '/')
|
||||
prefix = ctx->dirname;
|
||||
|
||||
if (fnlen < 4 || !streq(fn + fnlen - 4, ".bin"))
|
||||
suffix = ".bin";
|
||||
|
||||
snprintf(path, sizeof(path), "%s/%s%s",
|
||||
prefix, fn, suffix);
|
||||
fn = path;
|
||||
|
||||
ctx->indexes[i] = index_mm_open(ctx, fn, true);
|
||||
if (ctx->indexes[i] == NULL)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user