[haiku-commits] r40066 - haiku/trunk/src/system/boot/loader

  • From: ingo_weinhold@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 2 Jan 2011 15:22:32 +0100 (CET)

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) {


Other related posts:

  • » [haiku-commits] r40066 - haiku/trunk/src/system/boot/loader - ingo_weinhold