]> git.ipfire.org Git - thirdparty/systemd.git/commit
mtd: some basic code cleanups
authorLennart Poettering <lennart@poettering.net>
Tue, 24 Apr 2018 15:50:01 +0000 (17:50 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 10 May 2018 18:02:33 +0000 (11:02 -0700)
commit41b9d436b2739cbe8bf9482b665d85d59d06bc0e
tree2bc2096155081dab5f6588afd0d4a69a99cf0b9f
parent4319c181d4fc29d82f9431e69c29d03e7beecc01
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.
src/udev/mtd_probe/mtd_probe.c
src/udev/mtd_probe/mtd_probe.h
src/udev/mtd_probe/probe_smartmedia.c