util/cbmem: Handle arguments more carefully
Check if all arguments are handled by getopt and if not print the usage. Change-Id: Iccbb65ca768a62791af54afd9b7903495bc690af Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/27777 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
parent
4af5d9a94a
commit
8cd17eae2f
|
@ -1327,6 +1327,11 @@ int main(int argc, char** argv)
|
|||
}
|
||||
}
|
||||
|
||||
if (optind < argc) {
|
||||
fprintf(stderr, "Error: Extra parameter found.\n");
|
||||
print_usage(argv[0], 1);
|
||||
}
|
||||
|
||||
mem_fd = open("/dev/mem", O_RDONLY, 0);
|
||||
if (mem_fd < 0) {
|
||||
fprintf(stderr, "Failed to gain memory access: %s\n",
|
||||
|
|
Loading…
Reference in New Issue