daemon: cleanups to output error messages and silence compiler warnings

* make sure to print an error message when opening, reading or writing to
  various files/devices fails
* more updates for more consistent indentation and code style
* use booleans instead of strings as arguments to internal functions
* clean up unused includes and code
Merge pull request #18 from saaros/cleanup

daemon: cleanups to output error messages and silence compiler warnings