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

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