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=6d43bd729668c801f1fa3402b4d95fe4b0caf2c0 commit 6d43bd729668c801f1fa3402b4d95fe4b0caf2c0 Author: Guillem Jover <[email protected]> AuthorDate: Wed Feb 20 11:32:33 2019 +0100 dpkg: Simplify maintscript_set_exec_context() We do not really need to normalize the return code, which was confusing the cppcheck for which we required a supression. --- debian/changelog | 1 + src/script.c | 7 +++---- t/cppcheck/cppcheck.supp | 4 ---- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/debian/changelog b/debian/changelog index 7cdd3bbe4..c31d1fb23 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,7 @@ dpkg (1.19.5) UNRELEASED; urgency=medium Closes: #921557 * Code internals: - dpkg: Move SELinux fallback label to the SELinux specific code path. + - dpkg: Simplify maintscript_set_exec_context(). * Build system: - Check whether this dist is a release, based only on the version format. This will avoid having to do a two staged release to get a proper perl diff --git a/src/script.c b/src/script.c index f02ca509e..ea63093af 100644 --- a/src/script.c +++ b/src/script.c @@ -160,13 +160,12 @@ maintscript_pre_exec(struct command *cmd) static int maintscript_set_exec_context(struct command *cmd) { - int rc = 0; - #ifdef WITH_LIBSELINUX - rc = setexecfilecon(cmd->filename, "dpkg_script_t"); + return setexecfilecon(cmd->filename, "dpkg_script_t"); +#else + return 0; #endif - return rc < 0 ? rc : 0; } static int diff --git a/t/cppcheck/cppcheck.supp b/t/cppcheck/cppcheck.supp index 83f1821cb..6dcb19361 100644 --- a/t/cppcheck/cppcheck.supp +++ b/t/cppcheck/cppcheck.supp @@ -12,10 +12,6 @@ variableScope unusedStructMember:lib/compat/obstack.c nullPointerArithmetic:lib/compat/obstack.c -// Ignore, we use this construct to ease portability. -knownConditionTrueFalse:src/script.c:169 -duplicateExpressionTernary:src/script.c:169 - // Ignore, we are testing the functions. knownConditionTrueFalse:lib/dpkg/t/t-macros.c -- Dpkg.Org's dpkg

