Fix: libcrmcommon,tools: improve XML write error handling
The write_xml_*() functions previously would return -1 on error
(only sometimes setting errno for more information) and sometimes
0 (when compressed) or the number of bytes written (when uncompressed) on
success.
Some callers were relying on the return value being -errno, others relied on
errno being set if the return value was negative, and others relied on positive
values indicating success.
Now, the functions always return -errno on error, and the number of bytes
written (whether compressed or uncompressed) on success, and callers treat it
as such.
Also, error log messages have been improved.