Author: bonefish Date: 2011-01-02 15:22:32 +0100 (Sun, 02 Jan 2011) New Revision: 40066 Changeset: http://dev.haiku-os.org/changeset/40066 Modified: haiku/trunk/src/system/boot/loader/elf.cpp Log: Check return value of fstat() (CID 2513). Cannot really fail in the boot loader, but the check doesn't harm either. Modified: haiku/trunk/src/system/boot/loader/elf.cpp =================================================================== --- haiku/trunk/src/system/boot/loader/elf.cpp 2011-01-02 14:16:19 UTC (rev 40065) +++ haiku/trunk/src/system/boot/loader/elf.cpp 2011-01-02 14:22:32 UTC (rev 40066) @@ -13,6 +13,7 @@ #include <elf32.h> #include <kernel.h> +#include <errno.h> #include <unistd.h> #include <string.h> #include <stdlib.h> @@ -422,7 +423,8 @@ // 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) {