Blame SOURCES/cpio-2.10-longnames-split.patch

0ce6cf
From: Pavel Raiskup <praiskup@redhat.com>
0ce6cf
Date: Mon, 14 Sep 2015 09:49:12 +0200
0ce6cf
Subject: [PATCH 6/7] Fix for splitting long file names while creating ustar
0ce6cf
 archive
0ce6cf
0ce6cf
Resolves: #866467
0ce6cf
0ce6cf
diff --git a/src/tar.c b/src/tar.c
0ce6cf
index a2ce171..e2b5f45 100644
0ce6cf
--- a/src/tar.c
0ce6cf
+++ b/src/tar.c
0ce6cf
@@ -49,10 +49,12 @@ split_long_name (const char *name, size_t length)
0ce6cf
 {
0ce6cf
   size_t i;
0ce6cf
 
0ce6cf
-  if (length > TARPREFIXSIZE)
0ce6cf
-    length = TARPREFIXSIZE+2;
0ce6cf
+  if (length > TARPREFIXSIZE + 1)
0ce6cf
+    length = TARPREFIXSIZE + 1;
0ce6cf
+  else if (ISSLASH (name[length - 1]))
0ce6cf
+    length--;
0ce6cf
   for (i = length - 1; i > 0; i--)
0ce6cf
-    if (name[i] == '/')
0ce6cf
+    if (ISSLASH (name[i]))
0ce6cf
       break;
0ce6cf
   return i;
0ce6cf
 }