diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2010-11-24 13:37:55 +0100 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2010-11-24 13:37:55 +0100 |
commit | 1c7c724aee643060147e0bc792b428ca1c6cde02 (patch) | |
tree | 19340d3292ec0e54cf8a419b6c6a2d9673fdf51c | |
parent | bba31d7fbc06bfdac175e38649ca9b2331e44a5a (diff) |
Fix shadowed definition, use correct argument to strtoul
-rw-r--r-- | main.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -42,7 +42,7 @@ bool verbose = false; -static void usage_and_exit(const int status) +static void usage_and_exit(const int ret) { fprintf(stdout, "Usage: %s [OPTION...] IMAGE\n" " -b BASE, --baseaddr=BASE\n" @@ -65,7 +65,7 @@ static void usage_and_exit(const int status) PROGRAM_NAME, size_scale(DEFAULT_MEM_SIZE), size_postfix(DEFAULT_MEM_SIZE), PROGRAM_NAME); - exit(status); + exit(ret); } static const struct option long_opts[] = { { "baseaddr", required_argument, NULL, 'b' }, @@ -103,7 +103,7 @@ static size_t parse_mem_size(char *opt) } errno = 0; - mem_size = strtoul(optarg, NULL, 0); + mem_size = strtoul(opt, NULL, 0); if (errno != 0) { err("Invalid memory size: %s\n", opt); exit(EXIT_FAILURE); @@ -183,6 +183,8 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } + memset(mem.base, 0xfe, mem.size); + /* Load the image to memory */ if (image_load(image_path, image_format, &mem)) exit(EXIT_FAILURE); |