core: normalize 'r' variable handling in unit_attach_pids_to_cgroup() a bit
authorLennart Poettering <lennart@poettering.net>
Wed, 27 Oct 2021 21:08:58 +0000 (23:08 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 27 Oct 2021 21:11:23 +0000 (23:11 +0200)
commitdb4229d12f48663400802171b336c7cadbbe04ef
treec426ea97b6a0e335f1b4faefc0ee7b8348c228b1
parentd5bb2b0375b04449401cd43855722b60a4dcccd4
core: normalize 'r' variable handling in unit_attach_pids_to_cgroup() a bit

The 'r' variable is our "go-to" variable for error return codes, all
across our codebase. In unit_attach_pids_to_cgroup() it was so far used
in a strange way for most of the function: instead of directly storing
the error codes of functions we call we'd store it in a local variable
'q' instead, and propagate it to 'r' only  in some cases finally we'd
return the ultimate result of 'r'.

Let's normalize this a bit: let's always store error return values in
'r', and then use 'ret' as the variable to sometimes propagate errors
to, and then return that.

This also allows us to get rid of one local variable.

No actual codeflow changes, just some renaming of variables that allows
us to remove one.
src/core/cgroup.c