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)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 13 Jan 2022 09:48:46 +0000 (10:48 +0100)
commit3b13ae847a774fbfcbfca6bc27e8b854e5a0c332
tree9e7582990b39d0776f1eda1cdfe4a3bbc13389cf
parentfce582c71195415b7319df3fb3d777f7ca53933f
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.

(cherry picked from commit db4229d12f48663400802171b336c7cadbbe04ef)
(cherry picked from commit 84ec6a0043f7a447157753fb12e991ebce6e14b7)
src/core/cgroup.c