From efe10908766d96974c008a6a8f124916fdca7a14 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Mon, 15 Apr 2024 23:47:25 +0200 Subject: 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. --- userland/libgui/libgui.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'userland/libgui/libgui.c') 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 -- cgit v1.2.3