]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/install: propagate all errors in install_info_apply()
authorMike Yuan <me@yhndnzj.com>
Wed, 19 Jun 2024 16:59:15 +0000 (18:59 +0200)
committerMike Yuan <me@yhndnzj.com>
Wed, 19 Jun 2024 19:28:40 +0000 (21:28 +0200)
Currently, install_info_apply() only updates r if it's 0,
meaning that if one of the earlier install_info_symlink_alias/wants()
calls returns > 0, errors generated by later calls will be discarded.
Fix that.

src/shared/install.c

index 421266eb36b7ab55cff478055cf61eed4ccf8aa5..639372ae5bc34791289a31d483206233838d873c 100644 (file)
@@ -2152,15 +2152,15 @@ static int install_info_apply(
         r = install_info_symlink_alias(scope, info, lp, config_path, force, changes, n_changes);
 
         q = install_info_symlink_wants(scope, file_flags, info, lp, config_path, info->wanted_by, ".wants/", changes, n_changes);
-        if (r == 0)
+        if (q != 0 && r >= 0)
                 r = q;
 
         q = install_info_symlink_wants(scope, file_flags, info, lp, config_path, info->required_by, ".requires/", changes, n_changes);
-        if (r == 0)
+        if (q != 0 && r >= 0)
                 r = q;
 
         q = install_info_symlink_wants(scope, file_flags, info, lp, config_path, info->upheld_by, ".upholds/", changes, n_changes);
-        if (r == 0)
+        if (q != 0 && r >= 0)
                 r = q;
 
         return r;