ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
ff2b41
From 3d359367291484097c0b496f6d83726e4070d036 Mon Sep 17 00:00:00 2001
ff2b41
From: Frantisek Sumsal <fsumsal@redhat.com>
ff2b41
Date: Thu, 28 Feb 2019 11:09:24 +0100
ff2b41
Subject: [PATCH] shared/install: avoid overwriting 'r' counter with a partial
ff2b41
 result
ff2b41
ff2b41
We want to store either the first error or the total number of changes in 'r'.
ff2b41
Instead, we were overwriting this with the return value from
ff2b41
install_info_traverse().
ff2b41
ff2b41
LGTM complained later in the loop that:
ff2b41
> Comparison is always true because r >= 0.
ff2b41
ff2b41
Relevant commit: 459500a32cf74edca93ec79ee4cdd9dfcd20eee0
ff2b41
ff2b41
Resolves: #1694605
ff2b41
---
ff2b41
 src/shared/install.c | 6 +++---
ff2b41
 1 file changed, 3 insertions(+), 3 deletions(-)
ff2b41
ff2b41
diff --git a/src/shared/install.c b/src/shared/install.c
ff2b41
index ea01e4dcc2..f2f968e329 100644
ff2b41
--- a/src/shared/install.c
ff2b41
+++ b/src/shared/install.c
ff2b41
@@ -1482,9 +1482,9 @@ static int install_context_apply(
ff2b41
                 if (q < 0)
ff2b41
                         return q;
ff2b41
 
ff2b41
-                r = install_info_traverse(scope, c, root_dir, paths, i, flags, NULL);
ff2b41
-                if (r < 0)
ff2b41
-                        return r;
ff2b41
+                q = install_info_traverse(scope, c, root_dir, paths, i, flags, NULL);
ff2b41
+                if (q < 0)
ff2b41
+                        return q;
ff2b41
 
ff2b41
                 if (i->type != UNIT_FILE_TYPE_REGULAR)
ff2b41
                         continue;