Minor bug fixes (perror)

Use the error_msg.c functions for error handling instead of perror(3). I don't quite understand how, but it seems that under some circumstances STDERR output can end overwriting and corrupting RRD files, and they never end up in syslog.

Also fix a minor printf format string issue.