mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-11 17:00:37 +00:00
Kernel: Disallow loading a module twice without explicitly unloading it
This ensures that a module has the chance to run its cleanup functions before it's taken out of service.
This commit is contained in:
parent
ff3003c645
commit
9a8032b479
Notes:
sideshowbarker
2024-07-19 10:43:46 +09:00
Author: https://github.com/deoxxa Commit: https://github.com/SerenityOS/serenity/commit/9a8032b4791 Pull-request: https://github.com/SerenityOS/serenity/pull/906
1 changed files with 5 additions and 0 deletions
|
@ -3699,6 +3699,11 @@ int Process::sys$module_load(const char* path, size_t path_length)
|
|||
if (!module->module_init)
|
||||
return -EINVAL;
|
||||
|
||||
if (g_modules->contains(module->name)) {
|
||||
dbg() << "a module with the name " << module->name << " is already loaded; please unload it first";
|
||||
return -EEXIST;
|
||||
}
|
||||
|
||||
module->module_init();
|
||||
|
||||
auto name = module->name;
|
||||
|
|
Loading…
Reference in a new issue