Generalize the Linux error message a bit.
Unconditionally include stdint.h to prevent including it again in
input.c.
Trap and call cleanup() upon SIGINT (Ctrl-C) so that the log file is
flushed to disk.
No need to include stdint.h here anymore.
Add more safety belts, under weird circumstances the (f)close functions
would be called on already closed descriptors.