Log and break early if index is already open

This commit is contained in:
Lucas De Marchi 2011-12-14 03:53:43 -02:00
parent be5a6deaea
commit 3e67676617

View File

@ -615,12 +615,16 @@ KMOD_EXPORT int kmod_load_resources(struct kmod_ctx *ctx)
return -ENOENT; return -ENOENT;
for (i = 0; i < ARRAY_SIZE(index_files); i++) { for (i = 0; i < ARRAY_SIZE(index_files); i++) {
if (ctx->indexes[i] == NULL) {
const char *fn = index_files[i]; const char *fn = index_files[i];
size_t fnlen = strlen(fn); size_t fnlen = strlen(fn);
const char *prefix = ""; const char *prefix = "";
const char *suffix = ""; const char *suffix = "";
if (ctx->indexes[i] == NULL) {
INFO(ctx, "Index %s already loaded\n", fn);
continue;
}
if (fn[0] != '/') if (fn[0] != '/')
prefix = ctx->dirname; prefix = ctx->dirname;
@ -635,7 +639,6 @@ KMOD_EXPORT int kmod_load_resources(struct kmod_ctx *ctx)
if (ctx->indexes[i] == NULL) if (ctx->indexes[i] == NULL)
goto fail; goto fail;
} }
}
return 0; return 0;