This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=b006dc6ce5a78baba9c21f58048a8f65946d95ec

commit b006dc6ce5a78baba9c21f58048a8f65946d95ec
Author: Guillem Jover <[email protected]>
AuthorDate: Wed Jan 29 00:15:48 2020 +0100

    u-a: Remove redundant condition in argument parser
    
    This was really a redundant condition, and independent of the variable
    being an enum instead of a bool.
    
    Warned-by: cppcheck
---
 debian/changelog            | 1 +
 t/cppcheck/cppcheck.supp    | 3 ---
 utils/update-alternatives.c | 2 +-
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 9ea143548..349d869b4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -160,6 +160,7 @@ dpkg (1.20.0) UNRELEASED; urgency=medium
       requested packages. This also fixes a problematic cast removing the
       constness of a variable.
     - Dpkg::Dist::Files: Document the two filename pattern formats.
+    - update-alternatives: Remove redundant condition in argument parser.
   * Build system:
     - Bump minimal Perl version to 5.24.1.
     - Add a serial versioning to the m4 files.
diff --git a/t/cppcheck/cppcheck.supp b/t/cppcheck/cppcheck.supp
index 4b3794250..36202224f 100644
--- a/t/cppcheck/cppcheck.supp
+++ b/t/cppcheck/cppcheck.supp
@@ -34,9 +34,6 @@ knownConditionTrueFalse:src/depcon.c:668
 // BUG: False positive, the loop does an early exit.
 identicalInnerCondition:lib/dpkg/fsys-hash.c:100
 
-// BUG: False positive, this is an enum not a boolean.
-redundantCondition:utils/update-alternatives.c:2752
-
 // BUG: False positive, the macros from lib/dpkg/dlist.h use the tail member.
 unusedStructMember:lib/dpkg/triglib.c:378
 
diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 4b0fe2b21..8339e41f1 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -2749,7 +2749,7 @@ main(int argc, char **argv)
                        const char *slink, *sname, *spath;
                        struct slave_link *sl;
 
-                       if (action == ACTION_NONE || action != ACTION_INSTALL)
+                       if (action != ACTION_INSTALL)
                                badusage(_("--slave only allowed with 
--install"));
                        if (MISSING_ARGS(3))
                                badusage(_("--slave needs <link> <name> 
<path>"));

-- 
Dpkg.Org's dpkg

Reply via email to