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
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
#include <elf32.h>
|
#include <elf32.h>
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -422,7 +423,8 @@ elf_load_image(Directory *directory, const char *path)
|
|||||||
// check if this file has already been loaded
|
// check if this file has already been loaded
|
||||||
|
|
||||||
struct stat stat;
|
struct stat stat;
|
||||||
fstat(fd, &stat);
|
if (fstat(fd, &stat) < 0)
|
||||||
|
return errno;
|
||||||
|
|
||||||
image = gKernelArgs.preloaded_images;
|
image = gKernelArgs.preloaded_images;
|
||||||
for (; image != NULL; image = image->next) {
|
for (; image != NULL; image = image->next) {
|
||||||
|
|||||||
Reference in New Issue
Block a user