Add kdump_err_str to the API

This function should return a human-readable string representation of
the most recent error. Currently, it always returns NULL.

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
Clear error string in all public functions returning kdump_status

By convention, all functions that may fail should return kdump_status.
A failsafe function simply returns the value (or is void), so this
commit makes sure that old error messages are not kept.

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
Clear error in kdump_fdopen

If a format handler fails, it may set any arbitrary error messages.
But this error should be disregarded if another format handler is
tried later.

The error must also be cleared after a successful attempt, because
some optional information may be unavailable, but that should not
be reported.

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
Set a descriptive error message where an error is returned

Wherever a status is returned, make sure that a human-readable
error description is also set. This makes kdump_err_str() actually
return something sensible.

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
Use printf formatting to construct error messages

Static strings do not provide enough detail about the error condition
in many cases. Give error reporting more flexibility by converting
set_error to a printf-like function.

Furthermore, allow error message nesting - if a new error is reported
while another error is already logged, prepend the new error message,
delimited by a colon + space (": "). This allows to present not only
a detailed low-level message but also the context of that message.

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
Give more detail in error messages

Improve error messages throughout the whole code base:

 - include values where possible
 - add a description of the failed action for system errors
 - stack errors where necessary

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
Unify allocation error reporting

Provide a wrapper around malloc() that takes care of proper error
reporting.

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
Export target pointer size

Make target pointer size available to library users.

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>