]> git.ipfire.org Git - thirdparty/systemd.git/commit
util-lib: save/restore errno in cleanup calls
authorLennart Poettering <lennart@poettering.net>
Wed, 10 Jan 2018 16:21:15 +0000 (17:21 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 10 Jan 2018 16:21:15 +0000 (17:21 +0100)
commitdfd14786b5aa49c3c8e3866c0ecfa6d90c531eb6
treee3b449a6407f49f5ff5c4dda8d79ea3476f87f8d
parentad5d4b1703da43acfa69503c7101cb754066914c
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.
src/basic/fs-util.h
src/basic/process-util.c
src/basic/rm-rf.h