projects
/
emu8051.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fbbb71d
)
Dont exit in case of hexfile reading failure
author
Hugo Villeneuve
<hugo@hugovil.com>
Sat, 15 Feb 2014 23:07:29 +0000
(18:07 -0500)
committer
Hugo Villeneuve
<hugo@hugovil.com>
Sat, 15 Feb 2014 23:07:29 +0000
(18:07 -0500)
src/common/hexfile.c
patch
|
blob
|
history
diff --git
a/src/common/hexfile.c
b/src/common/hexfile.c
index
c9c7de3
..
ee0c745
100644
(file)
--- a/
src/common/hexfile.c
+++ b/
src/common/hexfile.c
@@
-108,14
+108,18
@@
hexfile_load(const char *filename)
log_debug("LoadHexFile");
log_debug("LoadHexFile");
- if (filename == NULL)
- log_fail("No file specified");
+ if (filename == NULL) {
+ log_err("No file specified");
+ return false;
+ }
/* Trying to open the file. */
fp = fopen(filename, "r");
/* Trying to open the file. */
fp = fopen(filename, "r");
- if (fp == NULL)
- log_fail("Error opening hex file <%s>: %s", filename,
- strerror(errno));
+ if (fp == NULL) {
+ log_err("Error opening hex file <%s>: %s", filename,
+ strerror(errno));
+ return false;
+ }
/* Reading one line of data from the hex file. */
/* char *fgets(char *s, int size, FILE *stream);
/* Reading one line of data from the hex file. */
/* char *fgets(char *s, int size, FILE *stream);
@@
-183,11
+187,12
@@
hexfile_load(const char *filename)
close_file:
status = fclose(fp);
close_file:
status = fclose(fp);
- if (status != EXIT_SUCCESS)
- log_
fail
("Error closing hex file");
-
- if (!valid)
+ if (status != EXIT_SUCCESS)
{
+ log_
err
("Error closing hex file");
+ valid = false;
+ } else if (!valid) {
log_err("Error parsing hex file");
log_err("Error parsing hex file");
+ }
return valid;
}
return valid;
}