Introduce UnexpectedError to handle non-fatal failures.

The error message is printed to stderr, and the function does not exit.
Fix linking after introduction of Unexpected Error
Handle return value from various C library and system calls
in cf-monitord and documentation tools.
Handle return values from chmod/chown/chdir
Handle parse errors in scanf calls.
Handle error code from fgets.

Also note that fgets should receive the size of the buffer including the
null terminator (ie writes num-1 bytes and sets the null terminator).
Merge pull request #293 from vohi/squash_warnings

Silence compiler warnings (esp on Ubuntu 12) by handling return codes from various system and C standard-library function calls. In most cases, no action taken other than logging the problem with CfOut or UnexpectedError.