mtd: some basic code cleanups
While looking at our exit() invocations I noticed that the mtd_probe
stuff uses 'exit(-1)' at various places, which is not really a good
idea, as exit codes of processes on Linux are supposed to be in the
range of 0…255.
This patch cleans that up a bit, and fixes a number of other things:
1. Let's always let main() exit, nothing intermediary. We generally
don't like code that invokes exit() on its own.
2. Close the file descriptors opened.
3. Some logging for errors is added, mostly on debug level.
Please review this with extra care. As I don't have the right hardware
to test this patch I only did superficial testing.
Author: Lennart Poettering lennart@poettering.net Date: Tue Apr 24 17:50:01 2018 +0200
systemd-commit: 41b9d436b2739cbe8bf9482b665d85d59d06bc0e