summaryrefslogtreecommitdiff
path: root/userland/libgui/libgui.c
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-04-15 23:47:25 +0200
committerAnton Kling <anton@kling.gg>2024-04-16 00:02:23 +0200
commitefe10908766d96974c008a6a8f124916fdca7a14 (patch)
tree69f90dc3c01d32d63a38ab50f61268b1ac06dc97 /userland/libgui/libgui.c
parent62ba2a9ab01e5f2a9b1cd325af8d3112702b7713 (diff)
Kernel: Improve "out of memory" error handling
It can now boot with fairly low memory while not crashing and instead gracefully failing the operation. Userland still does not properly handle errors.
Diffstat (limited to 'userland/libgui/libgui.c')
-rw-r--r--userland/libgui/libgui.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/userland/libgui/libgui.c b/userland/libgui/libgui.c
index f7a8079..07edbdd 100644
--- a/userland/libgui/libgui.c
+++ b/userland/libgui/libgui.c
@@ -308,10 +308,7 @@ GUI_Window *GUI_CreateWindow(uint32_t x, uint32_t y, uint32_t sx, uint32_t sy) {
ftruncate(w->bitmap_fd, MAX_WINDOW_SIZE * sizeof(uint32_t));
void *rc =
mmap(NULL, MAX_WINDOW_SIZE * sizeof(uint32_t), 0, 0, w->bitmap_fd, 0);
- if (!((int)rc >= 0)) {
- printf("rc: %x\n", rc);
- assert(0);
- }
+ assert(rc != (void *)(-1));
w->bitmap_ptr = rc;
// Send the request to the windowserver