]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
busctl: use RET_GATHER
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 19 Nov 2024 15:27:50 +0000 (16:27 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 27 Mar 2025 11:04:33 +0000 (12:04 +0100)
src/busctl/busctl.c

index 21f45df6822d3ec03475ab10876dd02840a7a8e5..557a4571f216cf1d27c67c3440e9517ef6caab49 100644 (file)
@@ -550,8 +550,6 @@ static int tree(int argc, char **argv, void *userdata) {
         char **args = strv_skip(argv, 1);
         if (args)
                 STRV_FOREACH(arg, args) {
-                        int q;
-
                         if (arg != args)
                                 puts("");
 
@@ -560,9 +558,7 @@ static int tree(int argc, char **argv, void *userdata) {
                                 printf("Service %s%s%s:\n", ansi_highlight(), *arg, ansi_normal());
                         }
 
-                        q = tree_one(bus, *arg);
-                        if (q < 0 && r >= 0)
-                                r = q;
+                        RET_GATHER(r, tree_one(bus, *arg));
                 }
         else {
                 _cleanup_strv_free_ char **names = NULL;
@@ -574,8 +570,6 @@ static int tree(int argc, char **argv, void *userdata) {
                 pager_open(arg_pager_flags);
 
                 STRV_FOREACH(name, names) {
-                        int q;
-
                         if (!arg_unique && (*name)[0] == ':')
                                 continue;
 
@@ -587,9 +581,7 @@ static int tree(int argc, char **argv, void *userdata) {
 
                         printf("Service %s%s%s:\n", ansi_highlight(), *name, ansi_normal());
 
-                        q = tree_one(bus, *name);
-                        if (q < 0 && r >= 0)
-                                r = q;
+                        RET_GATHER(r, tree_one(bus, *name));
                 }
         }