From 9a3d05d79570eb47b00e90ccabd754ebf2be18b1 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 2 Jan 2011 14:22:32 +0000 Subject: [PATCH] Check return value of fstat() (CID 2513). Cannot really fail in the boot loader, but the check doesn't harm either. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40066 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/boot/loader/elf.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) {