Blame SOURCES/findutils-4.6.0-covscan.patch

10a327
From 6b041f2bd5d84003d3945fc9ae18329f024b8d2a Mon Sep 17 00:00:00 2001
10a327
From: Bernhard Voelker <mail@bernhard-voelker.de>
10a327
Date: Thu, 2 Feb 2017 00:17:20 +0100
10a327
Subject: [PATCH 1/2] maint: avoid warnings from GCC 6.2.1
10a327
10a327
buildcmd.c: In function 'bc_push_arg':
10a327
buildcmd.c:362:11: error: this 'if' clause does not guard... [-Werror=misleading-indentation]
10a327
           if (ctl->replace_pat
10a327
           ^~
10a327
buildcmd.c:366:13: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
10a327
             bc_do_exec (ctl, state);
10a327
             ^~~~~~~~~~
10a327
pred.c: In function 'print_optlist':
10a327
pred.c:1328:46: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'long unsigned int' [-Werror=format=]
10a327
           fprintf (fp, "[real success rate %ld/%ld", p->perf.successes, p->perf.visits);
10a327
                                              ^
10a327
pred.c:1328:50: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'long unsigned int' [-Werror=format=]
10a327
           fprintf (fp, "[real success rate %ld/%ld", p->perf.successes, p->perf.visits);
10a327
                                                  ^
10a327
print.c: In function 'scan_for_digit_differences':
10a327
print.c:449:46: error: logical 'or' of equal expressions [-Werror=logical-op]
10a327
           if (!isdigit ((unsigned char)q[i]) || !isdigit ((unsigned char)q[i]))
10a327
                                              ^~
10a327
cc1: all warnings being treated as errors
10a327
10a327
* find/pred.c (print_optlist): Use %lu for unsigned long int.
10a327
* find/print.c (scan_for_digit_differences): Check p[i] too rather than
10a327
q[i] two times.
10a327
* lib/buildcmd.c (bc_push_arg): Fix indentation.
10a327
Use %lu format for unsigned long int.
10a327
10a327
Upstream-commit: 4bbc9e7a4a46d83ac5316cc5a57ad7ec5e12f74c
10a327
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
10a327
---
10a327
 find/pred.c    | 2 +-
10a327
 find/print.c   | 2 +-
10a327
 lib/buildcmd.c | 2 +-
10a327
 3 files changed, 3 insertions(+), 3 deletions(-)
10a327
10a327
diff --git a/find/pred.c b/find/pred.c
10a327
index 32938fb..5c8086e 100644
10a327
--- a/find/pred.c
10a327
+++ b/find/pred.c
10a327
@@ -1278,7 +1278,7 @@ print_optlist (FILE *fp, const struct predicate *p)
10a327
       fprintf (fp, " [%g] ", p->est_success_rate);
10a327
       if (options.debug_options & DebugSuccessRates)
10a327
 	{
10a327
-	  fprintf (fp, "[%ld/%ld", p->perf.successes, p->perf.visits);
10a327
+	  fprintf (fp, "[%lu/%lu", p->perf.successes, p->perf.visits);
10a327
 	  if (p->perf.visits)
10a327
 	    {
10a327
 	      double real_rate = (double)p->perf.successes / (double)p->perf.visits;
10a327
diff --git a/find/print.c b/find/print.c
10a327
index e4c28ad..17b9320 100644
10a327
--- a/find/print.c
10a327
+++ b/find/print.c
10a327
@@ -451,7 +451,7 @@ scan_for_digit_differences (const char *p, const char *q,
10a327
     {
10a327
       if (p[i] != q[i])
10a327
         {
10a327
-          if (!isdigit ((unsigned char)q[i]) || !isdigit ((unsigned char)q[i]))
10a327
+          if (!isdigit ((unsigned char)p[i]) || !isdigit ((unsigned char)q[i]))
10a327
             return false;
10a327
 
10a327
           if (!seen)
10a327
diff --git a/lib/buildcmd.c b/lib/buildcmd.c
10a327
index a58f67e..016ab1d 100644
10a327
--- a/lib/buildcmd.c
10a327
+++ b/lib/buildcmd.c
10a327
@@ -374,7 +374,7 @@ bc_push_arg (struct buildcmd_control *ctl,
10a327
               || (ctl->exit_if_size_exceeded &&
10a327
                   (ctl->lines_per_exec || ctl->args_per_exec)))
10a327
             error (EXIT_FAILURE, 0, _("argument list too long"));
10a327
-            bc_do_exec (ctl, state);
10a327
+          bc_do_exec (ctl, state);
10a327
         }
10a327
       if (bc_argc_limit_reached (initial_args, ctl, state))
10a327
             bc_do_exec (ctl, state);
10a327
-- 
10a327
2.17.2
10a327
10a327
10a327
From 55691f606c8aefa29a4b2f3061797e7f2b85981c Mon Sep 17 00:00:00 2001
10a327
From: Bernhard Voelker <mail@bernhard-voelker.de>
10a327
Date: Sun, 4 Feb 2018 18:20:25 +0100
10a327
Subject: [PATCH 2/2] maint: add missing va_end
10a327
10a327
'va_start' must have a corresponding 'va_end'.  Depending on the
10a327
implementation, the consequence of a missing 'va_end' may be a
10a327
corrupted stack.
10a327
10a327
* find/print.c (checked_fprintf): Add va_end.
10a327
10a327
Spotted by coverity analysis.
10a327
10a327
Upstream-commit: 76d7e2dcb45a3a558033209982772d21f68a6ea4
10a327
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
10a327
---
10a327
 find/print.c | 1 +
10a327
 1 file changed, 1 insertion(+)
10a327
10a327
diff --git a/find/print.c b/find/print.c
10a327
index 17b9320..ab1afc1 100644
10a327
--- a/find/print.c
10a327
+++ b/find/print.c
10a327
@@ -810,6 +810,7 @@ checked_fprintf (struct format_val *dest, const char *fmt, ...)
10a327
 
10a327
   va_start (ap, fmt);
10a327
   rv = vfprintf (dest->stream, fmt, ap);
10a327
+  va_end (ap);
10a327
   if (rv < 0)
10a327
     nonfatal_nontarget_file_error (errno, dest->filename);
10a327
 }
10a327
-- 
10a327
2.17.2
10a327