diff options
author | Itamar <itamar8910@gmail.com> | 2020-10-10 17:47:21 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-12-14 23:05:53 +0100 |
commit | 65ee2f07b725e8e71c156de8a8741e8e545c8786 (patch) | |
tree | 82550ed31769e6e956b9587470936fa51ea55564 /Libraries/LibC/assert.cpp | |
parent | b1c1d7661f51e04b733a77eadc416a0479721e18 (diff) | |
download | serenity-65ee2f07b725e8e71c156de8a8741e8e545c8786.zip |
LibC: Make it possible to use ASSERTs without initializing stdio
Diffstat (limited to 'Libraries/LibC/assert.cpp')
-rw-r--r-- | Libraries/LibC/assert.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Libraries/LibC/assert.cpp b/Libraries/LibC/assert.cpp index ae4ddfe7df..9e84b22cd6 100644 --- a/Libraries/LibC/assert.cpp +++ b/Libraries/LibC/assert.cpp @@ -27,15 +27,18 @@ #include <assert.h> #include <stdio.h> #include <stdlib.h> +#include <sys/internals.h> #include <unistd.h> extern "C" { +extern bool __stdio_is_initialized; #ifdef DEBUG void __assertion_failed(const char* msg) { dbgprintf("USERSPACE(%d) ASSERTION FAILED: %s\n", getpid(), msg); - fprintf(stderr, "ASSERTION FAILED: %s\n", msg); + if (__stdio_is_initialized) + fprintf(stderr, "ASSERTION FAILED: %s\n", msg); abort(); } #endif |