]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
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)
committerMike Yuan <me@yhndnzj.com>
Wed, 19 Jun 2024 19:28:55 +0000 (21:28 +0200)
Follow-up for b2751cf0394d36c24590b5f7b33e9f864b57ba0d

Also make the conditions consistent for install_info_symlink_wants().

Fixes #33411

src/shared/install.c

index 639372ae5bc34791289a31d483206233838d873c..ca8e7d2733fc64c49a24bbbd85cc5dcccc4da2ad 100644 (file)
@@ -1986,7 +1986,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;
@@ -2080,7 +2082,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) {