diff options
author | Patrick Georgi <patrick.georgi@coresystems.de> | 2009-09-15 08:21:46 +0000 |
---|---|---|
committer | Patrick Georgi <patrick.georgi@coresystems.de> | 2009-09-15 08:21:46 +0000 |
commit | 45d8a83b29e9eb2e20f4ca39914a42561a2c1f79 (patch) | |
tree | e4060262f2811d96ab9b11b69ddb2c062e565062 /util/cbfstool/cbfstool.c | |
parent | fd9c9b8ff8326c07bd63b39ab85bd68f6fb6a011 (diff) | |
download | coreboot-45d8a83b29e9eb2e20f4ca39914a42561a2c1f79.tar.xz |
More error checking when trying to open files in
cbfstool. (trivial)
Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
Acked-by: Patrick Georgi <patrick.georgi@coresystems.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4634 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/cbfstool/cbfstool.c')
-rw-r--r-- | util/cbfstool/cbfstool.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c index 637bddb1fc..1862af4e25 100644 --- a/util/cbfstool/cbfstool.c +++ b/util/cbfstool/cbfstool.c @@ -57,6 +57,10 @@ int main(int argc, char **argv) } void *rom = loadrom(romname); + if (rom == NULL) { + printf("Could not load ROM image '%s'.\n", romname); + return 1; + } if (strcmp(cmd, "print") == 0) { print_cbfs_directory(romname); @@ -68,11 +72,15 @@ int main(int argc, char **argv) return 1; } - void *filename = argv[3]; - void *cbfsname = argv[4]; + char *filename = argv[3]; + char *cbfsname = argv[4]; uint32_t filesize = 0; void *filedata = loadfile(filename, &filesize, 0, SEEK_SET); + if (filedata == NULL) { + printf("Could not load file '%s'.\n", filename); + return 1; + } uint32_t base = 0; void *cbfsfile; |