]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
unit_is_bound_by_inactive: fix return pointer check
authorDominique Martinet <asmadeus@codewreck.org>
Wed, 24 Nov 2021 13:27:22 +0000 (22:27 +0900)
committerLennart Poettering <lennart@poettering.net>
Wed, 24 Nov 2021 17:42:37 +0000 (18:42 +0100)
*ret_culprit should be set if ret_culprit has been passed a non-null value,
checking the previous *ret_culprit value does not make sense.

This would cause the culprit to not properly be assigned, leading to
pid1 crash when a unit could not be stopped.

Fixes: #21476
src/core/unit.c

index fa21b8acb2fd96867c613267453a519ef1dc17fe..e4f8bac442b8020d060e03fd8085cc9fcd0c1ca2 100644 (file)
@@ -2129,7 +2129,7 @@ bool unit_is_bound_by_inactive(Unit *u, Unit **ret_culprit) {
                         continue;
 
                 if (UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(other))) {
-                        if (*ret_culprit)
+                        if (ret_culprit)
                                 *ret_culprit = other;
 
                         return true;