linux-user/elfload: Latch errno before cleanup in elf_core_dump
commitccb6f3eee0f746961f95e9956fa20decd1f46da3
authorRichard Henderson <richard.henderson@linaro.org>
Tue, 27 Feb 2024 02:58:02 +0000 (26 16:58 -1000)
committerRichard Henderson <richard.henderson@linaro.org>
Thu, 29 Feb 2024 18:48:02 +0000 (29 08:48 -1000)
treeff1fb2e82531e4fb80d1077a97ddd8ddafe333fc
parent0af22a6abf8397f966701f120eee8a5bdf22ab19
linux-user/elfload: Latch errno before cleanup in elf_core_dump

On the off-chance that one of the cleanup functions changes
errno, latch the errno that we want to return beforehand.

Flush errno to 0 upon success, rather than at the beginning.
No need to avoid negation of 0.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
linux-user/elfload.c