diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-10-25 17:12:14 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-10-28 14:36:53 +0200 |
commit | f5a0162d2007b549bcf9f6c60fdfd96ee593569f (patch) | |
tree | 3b588d3454950ecef9b5e8a8ccbd6f89318d9864 /src/shared/install.c | |
parent | test-network: rewrite wait-online address family tests (diff) | |
download | systemd-f5a0162d2007b549bcf9f6c60fdfd96ee593569f.tar.xz systemd-f5a0162d2007b549bcf9f6c60fdfd96ee593569f.zip |
install: process all Wants= symlinks even if some of them fail
Follow-up for 94e7298d309fef7710174def820e9d38e512a086.
Fixes CID#1499992.
Diffstat (limited to 'src/shared/install.c')
-rw-r--r-- | src/shared/install.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/shared/install.c b/src/shared/install.c index 6d91a02f11..834a1c59e3 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -1973,12 +1973,16 @@ static int install_info_symlink_wants( n = info->name; } + r = 0; STRV_FOREACH(s, list) { _cleanup_free_ char *path = NULL, *dst = NULL; q = install_name_printf(scope, info, *s, &dst); - if (q < 0) - return install_changes_add(changes, n_changes, q, *s, NULL); + if (q < 0) { + install_changes_add(changes, n_changes, q, *s, NULL); + if (r >= 0) + r = q; + } if (!unit_name_is_valid(dst, valid_dst_type)) { /* Generate a proper error here: EUCLEAN if the name is generally bad, EIDRM if the @@ -1992,9 +1996,11 @@ static int install_info_symlink_wants( continue; if (unit_name_is_valid(dst, UNIT_NAME_ANY)) - return install_changes_add(changes, n_changes, -EIDRM, dst, n); + q = install_changes_add(changes, n_changes, -EIDRM, dst, n); else - return install_changes_add(changes, n_changes, -EUCLEAN, dst, NULL); + q = install_changes_add(changes, n_changes, -EUCLEAN, dst, NULL); + if (r >= 0) + r = q; continue; } @@ -2004,7 +2010,7 @@ static int install_info_symlink_wants( return -ENOMEM; q = create_symlink(lp, info->path, path, true, changes, n_changes); - if (r == 0) + if ((q < 0 && r >= 0) || r == 0) r = q; if (unit_file_exists(scope, lp, dst) == 0) { |