diff mbox series

[5/6] libkmod: allow modules.alias.builtin to be optional

Message ID 20200310050029.27678-6-lucas.demarchi@intel.com (mailing list archive)
State New, archived
Headers show
Series Fix modules.builtin.alias handling | expand

Commit Message

Lucas De Marchi March 10, 2020, 5 a.m. UTC
---
 libkmod/libkmod.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
index ab5c1e8..43423d6 100644
--- a/libkmod/libkmod.c
+++ b/libkmod/libkmod.c
@@ -855,8 +855,8 @@  KMOD_EXPORT int kmod_validate_resources(struct kmod_ctx *ctx)
  */
 KMOD_EXPORT int kmod_load_resources(struct kmod_ctx *ctx)
 {
+	int ret = 0;
 	size_t i;
-	int ret;
 
 	if (ctx == NULL)
 		return -ENOENT;
@@ -874,8 +874,17 @@  KMOD_EXPORT int kmod_load_resources(struct kmod_ctx *ctx)
 							index_files[i].fn);
 		ret = index_mm_open(ctx, path, &ctx->indexes_stamp[i],
 				    &ctx->indexes[i]);
-		if (ret)
-			break;
+
+		/*
+		 * modules.builtin.alias are considered optional since it's
+		 * recently added and older installations may not have it;
+		 * we allow failing for any reason
+		 */
+		if (ret) {
+			if (i != KMOD_INDEX_MODULES_BUILTIN_ALIAS)
+				break;
+			ret = 0;
+		}
 	}
 
 	if (ret)