[LTP] [PATCH 8/8] syscalls/setresuid03: Convert to new API

Cyril Hrubis chrubis@suse.cz
Mon Sep 13 16:51:20 CEST 2021


Hi!
> >> -?????? if (getpwnam("bin") == NULL) {
> >> -?????????????? tst_brkm(TBROK, NULL, "bin must be a valid user.");
> >> +?????? if (TST_ERR != tc->exp_errno) {
> > nit: checkpatch complains (TST_ERR should be second)
> 
> checkpatch.pl wrongly assumes that TST_ERR is a constant.

Good catch, I guess that we will have to patch checkpatch to ignore
macros that start with TST_, what about?

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 88cb294dc..87572b2f4 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5462,7 +5462,9 @@ sub process {
                        my $comp = $3;
                        my $to = $4;
                        my $newcomp = $comp;
-                       if ($lead !~ /(?:$Operators|\.)\s*$/ &&
+
+                       if ($const !~ /^\QTST_/ &&
+                           $lead !~ /(?:$Operators|\.)\s*$/ &&
                            $to !~ /^(?:Constant|[A-Z_][A-Z0-9_]*)$/ &&
                            WARN("CONSTANT_COMPARISON",
                                 "Comparisons should place the constant on the right side of the test\n" . $herecurr) &&


-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list