Blame SOURCES/findutils-4.6.0-covscan.patch

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