summaryrefslogtreecommitdiff
path: root/Libraries/LibC/assert.cpp
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2020-10-10 17:47:21 +0300
committerAndreas Kling <kling@serenityos.org>2020-12-14 23:05:53 +0100
commit65ee2f07b725e8e71c156de8a8741e8e545c8786 (patch)
tree82550ed31769e6e956b9587470936fa51ea55564 /Libraries/LibC/assert.cpp
parentb1c1d7661f51e04b733a77eadc416a0479721e18 (diff)
downloadserenity-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.cpp5
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