Skip to content
Commit 637605d2 authored by Lennart Poettering's avatar Lennart Poettering Committed by Zbigniew Jędrzejewski-Szmek
Browse files

util-lib: save/restore errno in cleanup calls

We should be careful with errno in cleanup functions, and not alter it
under any circumstances. In the safe_close cleanup handlers we are
already safe in that regard, but let's add similar protections on other
cleanup handlers that invoke system calls.

Why bother? Cleanup handlers insert code at function return in
non-obvious ways. Hence, code that sets errno and returns should not be
confused by us overrding the errno from a cleanup handler.

This is a paranoia fix only, I am not aware where this actually mattered
in real-life situations.

(cherry picked from commit dfd14786)
parent a27ba9be
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment