]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #12407 from keszybz/two-unrelated-cleanups
authorLennart Poettering <lennart@poettering.net>
Fri, 26 Apr 2019 21:43:27 +0000 (23:43 +0200)
committerGitHub <noreply@github.com>
Fri, 26 Apr 2019 21:43:27 +0000 (23:43 +0200)
Two unrelated cleanups

src/core/cgroup.c
src/network/networkd-link.c

index e4e0965bfbf386512baaf307ff97ddec4bac2a08..bf9b63324518153ad00dd6627b252f0b834f1c7a 100644 (file)
@@ -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;              \
                 }                                                       \
                                                                         \
index d3928e2862f3a034a4f8a7c1a9a51c3922ce7d6b..ec2190fd13c796d6f3b563f0f6551ed5b1102056 100644 (file)
@@ -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) {