From 1c7c724aee643060147e0bc792b428ca1c6cde02 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 24 Nov 2010 13:37:55 +0100 Subject: Fix shadowed definition, use correct argument to strtoul --- main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index bc0136c..837dbe1 100644 --- a/main.c +++ b/main.c @@ -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); -- cgit v1.2.3-54-g00ecf