]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tmpfiles: use RET_GATHER more
authorMike Yuan <me@yhndnzj.com>
Thu, 19 Sep 2024 11:37:48 +0000 (13:37 +0200)
committerMike Yuan <me@yhndnzj.com>
Thu, 19 Sep 2024 22:00:01 +0000 (00:00 +0200)
src/tmpfiles/tmpfiles.c

index 16f831bc2624550ab920716c82d29ef7173a2f33..a9faa5c474afdc5482342c7c05d5fa710c319011 100644 (file)
@@ -4551,7 +4551,7 @@ static int run(int argc, char *argv[]) {
                 PHASE_CREATE,
                 _PHASE_MAX
         } phase;
-        int r, k;
+        int r;
 
         r = parse_argv(argc, argv);
         if (r <= 0)
@@ -4694,18 +4694,12 @@ static int run(int argc, char *argv[]) {
                         continue;
 
                 /* The non-globbing ones usually create things, hence we apply them first */
-                ORDERED_HASHMAP_FOREACH(a, c.items) {
-                        k = process_item_array(&c, a, op);
-                        if (k < 0 && r >= 0)
-                                r = k;
-                }
+                ORDERED_HASHMAP_FOREACH(a, c.items)
+                        RET_GATHER(r, process_item_array(&c, a, op));
 
                 /* The globbing ones usually alter things, hence we apply them second. */
-                ORDERED_HASHMAP_FOREACH(a, c.globs) {
-                        k = process_item_array(&c, a, op);
-                        if (k < 0 && r >= 0)
-                                r = k;
-                }
+                ORDERED_HASHMAP_FOREACH(a, c.globs)
+                        RET_GATHER(r, process_item_array(&c, a, op));
         }
 
         if (ERRNO_IS_RESOURCE(r))