Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
38 magnus 1
Description: Detect old-style GNU headers correctly
2
Author: Steinar H. Gunderson <sesse@debian.org>
3
 
4
--- libtar-1.2.20.orig/lib/decode.c
5
+++ libtar-1.2.20/lib/decode.c
6
@@ -69,7 +69,14 @@ th_get_pathname(TAR *t)
7
                        return NULL;
8
        }
9
 
10
-       if (t->th_buf.prefix[0] == '\0')
11
+       /*
12
+        * Old GNU headers (also used by newer GNU tar when doing incremental
13
+        * dumps) use the POSIX prefix field for many other things, such as
14
+        * mtime and ctime. New-style GNU headers don't, but also don't use the
15
+        * POSIX prefix field. Thus, only honor the prefix field if the archive
16
+        * is actually a POSIX archive. This is the same logic as GNU tar uses.
17
+        */
18
+       if (strncmp(t->th_buf.magic, TMAGIC, TMAGLEN - 1) != 0 || t->th_buf.prefix[0] == '\0')
19
        {
20
                sprintf(t->th_pathname, "%.100s", t->th_buf.name);
21
        }