Carl-Daniel Hailfinger wrote:
@@ -729,6 +730,7 @@ for (i = 0; i < ARRAY_SIZE(flashes) && flashes[i]; i++) printf(" %s", flashes[i]->name); printf("\nPlease specify which chip to use with the -c <chipname> option.\n");
exit(1);programmer_shutdown();
The repeated programmer_shutdown(); exit(1); pattern makes it clear that we need a function exit_and_shutdown(int exitcode). That function should replace exit() almost everywhere.
Maybe programmer_shutdown should be hooked into the exit handler using atexit(3)? I don't think it's necessary (nor desirable) to exchange exit() by something else, given libc provides us some pretty nice mechanisms here.
Stefan