dryang / rpms / systemd

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