shared/install: correctly report changes in install_info_symlink_alias()
authorMike Yuan <me@yhndnzj.com>
Wed, 19 Jun 2024 16:45:14 +0000 (18:45 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 19 Jul 2024 22:33:14 +0000 (00:33 +0200)
Follow-up for b2751cf0394d36c24590b5f7b33e9f864b57ba0d

Also make the conditions consistent for install_info_symlink_wants().

Fixes #33411

(cherry picked from commit 4441cf330b3847d6c553fb230e8e4c86aa75ebb9)

src/shared/install.c

index 2aff1f6e67c1c552b9a85f9c57009f30294326bc..53566b7eef7fe8240e749d12cb1e5142cb8035cd 100644 (file)
@@ -1989,7 +1989,9 @@ static int install_info_symlink_alias(
                 }
                 broken = r == 0; /* symlink target does not exist? */
 
-                RET_GATHER(ret, create_symlink(lp, alias_target ?: info->path, alias_path, force || broken, changes, n_changes));
+                r = create_symlink(lp, alias_target ?: info->path, alias_path, force || broken, changes, n_changes);
+                if (r != 0 && ret >= 0)
+                        ret = r;
         }
 
         return ret;
@@ -2083,7 +2085,7 @@ static int install_info_symlink_wants(
                         return -ENOMEM;
 
                 q = create_symlink(lp, info->path, path, /* force = */ true, changes, n_changes);
-                if ((q < 0 && r >= 0) || r == 0)
+                if (q != 0 && r >= 0)
                         r = q;
 
                 if (unit_file_exists(scope, lp, dst) == 0) {