From 012605adf99bb01acb350b97a49786f645f8b5cf Mon Sep 17 00:00:00 2001 From: mintsuki Date: Thu, 30 Mar 2023 02:43:52 +0200 Subject: [PATCH] limine: Fix issue with internal modules and kernels in root dir --- common/protos/limine.c | 2 +- test/limine.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/common/protos/limine.c b/common/protos/limine.c index 773ac88e..96558245 100644 --- a/common/protos/limine.c +++ b/common/protos/limine.c @@ -320,7 +320,7 @@ noreturn void limine_load(char *config, char *cmdline) { strcpy(k_path_ + 1, k_path); k_path = k_path_; for (size_t i = strlen(k_path) - 1; ; i--) { - if (k_path[i] == '/') { + if (k_path[i] == '/' || i == 1) { k_path[i] = 0; break; } diff --git a/test/limine.c b/test/limine.c index dbcd60b3..05ac5f55 100644 --- a/test/limine.c +++ b/test/limine.c @@ -65,16 +65,22 @@ struct limine_internal_module internal_module2 = { .cmdline = "Second internal module" }; +struct limine_internal_module internal_module3 = { + .path = "./limine.cfg", + .cmdline = "Second internal module" +}; + struct limine_internal_module *internal_modules[] = { &internal_module1, - &internal_module2 + &internal_module2, + &internal_module3 }; struct limine_module_request module_request = { .id = LIMINE_MODULE_REQUEST, .revision = 1, .response = NULL, - .internal_module_count = 2, + .internal_module_count = 3, .internal_modules = internal_modules };