summaryrefslogtreecommitdiffstats
path: root/target-ia64
diff options
context:
space:
mode:
authorZhang Xiantao <[email protected]>2008-01-03 17:22:36 +0800
committerAvi Kivity <[email protected]>2008-01-03 17:42:08 +0200
commit363b1e4787403f3411e2b86417f00f9d684d10f4 (patch)
treebb7d0f82137e08ec06ba17384aedc888641326bc /target-ia64
parentcc39d5e874d16a7e13875b16105e4f2b50bcd1b6 (diff)
downloadqemu-kvm-363b1e4787403f3411e2b86417f00f9d684d10f4.tar.gz
qemu-kvm-363b1e4787403f3411e2b86417f00f9d684d10f4.tar.bz2
qemu-kvm-363b1e4787403f3411e2b86417f00f9d684d10f4.zip
Ia64: Add check for guest firmware.
Add the existence check before reading the image. Signed-off-by: Zhang Xiantao <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
Diffstat (limited to 'target-ia64')
-rw-r--r--target-ia64/firmware.c18
-rw-r--r--target-ia64/firmware.h2
2 files changed, 14 insertions, 6 deletions
diff --git a/target-ia64/firmware.c b/target-ia64/firmware.c
index 51650c884..b8259e051 100644
--- a/target-ia64/firmware.c
+++ b/target-ia64/firmware.c
@@ -22,6 +22,10 @@
#include <string.h>
#include <stdlib.h>
#include <zlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
#include "cpu.h"
#include "firmware.h"
@@ -514,16 +518,17 @@ char *read_image(const char *filename, unsigned long *size)
if ( (filename == NULL) || (size == NULL) )
return NULL;
- if ( (kernel_fd = open(filename, O_RDONLY)) < 0 )
+ kernel_fd = open(filename, O_RDONLY);
+ if (kernel_fd < 0)
{
- Hob_Output("Could not open kernel image");
- goto out;
+ Hob_Output("Could not open kernel image\n");
+ goto out_1;
}
if ( (kernel_gfd = gzdopen(kernel_fd, "rb")) == NULL )
{
- Hob_Output("Could not allocate decompression state for state file");
- goto out;
+ Hob_Output("Could not allocate decompression state for state file\n");
+ goto out_1;
}
*size = 0;
@@ -577,6 +582,9 @@ char *read_image(const char *filename, unsigned long *size)
else if ( kernel_fd >= 0 )
close(kernel_fd);
return image;
+
+out_1:
+ return NULL;
}
/*
diff --git a/target-ia64/firmware.h b/target-ia64/firmware.h
index 1c4e534c2..dde8b2dd9 100644
--- a/target-ia64/firmware.h
+++ b/target-ia64/firmware.h
@@ -36,7 +36,7 @@
#define HOB_OFFSET (GFW_HOB_START-GFW_START)
#define Hob_Output(s) \
- fprintf(stderr, strcat("HOB:",s))
+ fprintf(stderr, s)
extern int kvm_ia64_build_hob(unsigned long memsize,
unsigned long vcpus, uint8_t* fw_start);