diff --git a/src/system/boot/loader/elf.cpp b/src/system/boot/loader/elf.cpp index c871142d3d..1e56c90453 100644 --- a/src/system/boot/loader/elf.cpp +++ b/src/system/boot/loader/elf.cpp @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -422,7 +423,8 @@ elf_load_image(Directory *directory, const char *path) // check if this file has already been loaded struct stat stat; - fstat(fd, &stat); + if (fstat(fd, &stat) < 0) + return errno; image = gKernelArgs.preloaded_images; for (; image != NULL; image = image->next) {