Blame SOURCES/coreutils-8.32-coverity-utimens.patch

e63663
From 51b9a8ba0974d262e0b0f81a2078b3c7907b25ed Mon Sep 17 00:00:00 2001
e63663
From: Paul Eggert <eggert@cs.ucla.edu>
e63663
Date: Wed, 7 Apr 2021 17:29:59 -0700
e63663
Subject: [PATCH] utimens: fix confusing arg type in internal func
e63663
MIME-Version: 1.0
e63663
Content-Type: text/plain; charset=UTF-8
e63663
Content-Transfer-Encoding: 8bit
e63663
e63663
Although the old code was technically correct, this was accidental
e63663
and it understandably confused Coverity.  Reported by Ondrej Dubaj in:
e63663
https://lists.gnu.org/r/bug-tar/2021-04/msg00000.html
e63663
* lib/utimens.c (update_timespec): Change arg type from ‘struct
e63663
timespec *[2]’ (pointer to array of 2 pointers to timespecs) to
e63663
‘struct timespec **’ (pointer to pointer to the first timespec in
e63663
an array of 2 timespecs).  Although the old code happened to be
e63663
technically correct, it was misleading and confused Coverity.
e63663
And though the type ‘struct timespec (**)[2]’ (pointer to pointer
e63663
to array of 2 timespecs) would perhaps be more technically
e63663
correct, it would be almost as confusing and would require changes
e63663
elsewhere in this file; let’s quit while we’re ahead.
e63663
e63663
Upstream-commit: a3a946f670718d0dee5a7425ad5ac0a29fb46ea1
e63663
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
e63663
---
e63663
 lib/utimens.c | 6 +++---
e63663
 1 file changed, 3 insertions(+), 3 deletions(-)
e63663
e63663
diff --git a/lib/utimens.c b/lib/utimens.c
e63663
index 3f53942..ea8c672 100644
e63663
--- a/lib/utimens.c
e63663
+++ b/lib/utimens.c
e63663
@@ -123,14 +123,14 @@ validate_timespec (struct timespec timespec[2])
e63663
   return result + (utime_omit_count == 1);
e63663
 }
e63663
 
e63663
-/* Normalize any UTIME_NOW or UTIME_OMIT values in *TS, using stat
e63663
-   buffer STATBUF to obtain the current timestamps of the file.  If
e63663
+/* Normalize any UTIME_NOW or UTIME_OMIT values in (*TS)[0] and (*TS)[1],
e63663
+   using STATBUF to obtain the current timestamps of the file.  If
e63663
    both times are UTIME_NOW, set *TS to NULL (as this can avoid some
e63663
    permissions issues).  If both times are UTIME_OMIT, return true
e63663
    (nothing further beyond the prior collection of STATBUF is
e63663
    necessary); otherwise return false.  */
e63663
 static bool
e63663
-update_timespec (struct stat const *statbuf, struct timespec *ts[2])
e63663
+update_timespec (struct stat const *statbuf, struct timespec **ts)
e63663
 {
e63663
   struct timespec *timespec = *ts;
e63663
   if (timespec[0].tv_nsec == UTIME_OMIT
e63663
-- 
e63663
2.26.3
e63663