diff --git a/src/core/cgroup.c b/src/core/cgroup.c index e4e0965bfbf..bf9b6332451 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -403,15 +403,12 @@ int cgroup_add_device_allow(CGroupContext *c, const char *dev, const char *mode) assert(u); \ \ c = unit_get_cgroup_context(u); \ - \ - if (c->entry##_set) \ + if (c && c->entry##_set) \ return c->entry; \ \ - while (UNIT_ISSET(u->slice)) { \ - u = UNIT_DEREF(u->slice); \ + while ((u = UNIT_DEREF(u->slice))) { \ c = unit_get_cgroup_context(u); \ - \ - if (c->default_##entry##_set) \ + if (c && c->default_##entry##_set) \ return c->default_##entry; \ } \ \ diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index d3928e2862f..ec2190fd13c 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -3365,7 +3365,7 @@ static int link_initialized_and_synced(Link *link) { /* We may get called either from the asynchronous netlink callback, * or directly for link_add() if running in a container. See link_add(). */ if (!IN_SET(link->state, LINK_STATE_PENDING, LINK_STATE_INITIALIZED)) - return 1; + return 0; log_link_debug(link, "Link state is up-to-date"); link_set_state(link, LINK_STATE_INITIALIZED); @@ -3383,7 +3383,7 @@ static int link_initialized_and_synced(Link *link) { &link->mac, &network); if (r == -ENOENT) { link_enter_unmanaged(link); - return 1; + return 0; } else if (r == 0 && network->unmanaged) { link_enter_unmanaged(link); return 0; @@ -3420,7 +3420,7 @@ static int link_initialized_and_synced(Link *link) { if (r < 0) return r; - return 1; + return 0; } static int link_initialized_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {