LibC: Initialize libc only once

This was breaking stuff with dynamic loader initializing libc and main
executable reinitializing it later :D
This commit is contained in:
Bananymous 2024-09-24 17:56:12 +03:00
parent 39802b56c1
commit 4e9f39384a
1 changed files with 5 additions and 0 deletions

View File

@ -20,6 +20,11 @@ extern void _init_malloc();
extern void _init_stdio(); extern void _init_stdio();
extern "C" void _init_libc(char** _environ) extern "C" void _init_libc(char** _environ)
{ {
static bool is_initialized = false;
if (is_initialized)
return;
is_initialized = true;
_init_malloc(); _init_malloc();
_init_stdio(); _init_stdio();