Add processing to save errno before outputting DEBUG
In some processes, DEBUG is output after a system call error, and errno is returned.
errno should be saved before DEBUG is output.
Add a process to save errno before outputting DEBUG so that errno is not overwritten in DEBUG output process.
Reviewed-by: Alexey Tikhonov <atikhono@redhat.com>