shared/install: avoid overwriting 'r' counter with a partial result

We want to store either the first error or the total number of changes in 'r'.
Instead, we were overwriting this with the return value from
install_info_traverse().

LGTM complained later in the loop that:
> Comparison is always true because r >= 0.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2018-10-02 15:36:24 +02:00
parent 0a587335d2
commit 459500a32c
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -1896,10 +1896,10 @@ static int install_context_apply(
if (q < 0)
return q;
r = install_info_traverse(scope, c, paths, i, flags, NULL);
if (r < 0) {
q = install_info_traverse(scope, c, paths, i, flags, NULL);
if (q < 0) {
unit_file_changes_add(changes, n_changes, r, i->name, NULL);
return r;
return q;
}
/* We can attempt to process a masked unit when a different unit