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>
Wed, 10 Nov 2021 14:01:30 +0000 (15:01 +0100)
commit84ec6a0043f7a447157753fb12e991ebce6e14b7
treea0670d10c9aa7ce2b508afd0642af6fbd15339b5
parent04e07e55723a92bfc0cd4e84482cbef96604e706
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)
src/core/cgroup.c