From 4e9f39384a1115d5833b11d73f4856fec176ce4e Mon Sep 17 00:00:00 2001 From: Bananymous Date: Tue, 24 Sep 2024 17:56:12 +0300 Subject: [PATCH] LibC: Initialize libc only once This was breaking stuff with dynamic loader initializing libc and main executable reinitializing it later :D --- userspace/libraries/LibC/unistd.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/userspace/libraries/LibC/unistd.cpp b/userspace/libraries/LibC/unistd.cpp index 5553373145..f12f533275 100644 --- a/userspace/libraries/LibC/unistd.cpp +++ b/userspace/libraries/LibC/unistd.cpp @@ -20,6 +20,11 @@ extern void _init_malloc(); extern void _init_stdio(); extern "C" void _init_libc(char** _environ) { + static bool is_initialized = false; + if (is_initialized) + return; + is_initialized = true; + _init_malloc(); _init_stdio();