bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tar 1.13.19: create with --absolute-names, extract without -> hard lin


From: Jonathan Kamens
Subject: tar 1.13.19: create with --absolute-names, extract without -> hard links won't work
Date: Mon, 20 Aug 2001 09:15:13 -0400

If you create a tar archive with --absolute-names and then extract it
without that option, any hard links in the tar archive won't be
created properly.  A patch is below.

--- tar-1.13.19/src/extract.c~  Sat Jan 13 00:59:29 2001
+++ tar-1.13.19/src/extract.c   Mon Aug 20 08:50:49 2001
@@ -932,10 +932,19 @@
       {
        struct stat st1, st2;
        int e;
+       size_t skiplinkcrud;
+
+       if (absolute_names_option)
+         skiplinkcrud = 0;
+       else {
+         skiplinkcrud = FILESYSTEM_PREFIX_LEN (current_link_name);
+         while (ISSLASH (current_link_name[skiplinkcrud]))
+           skiplinkcrud++;
+       }
 
        /* MSDOS does not implement links.  However, djgpp's link() actually
           copies the file.  */
-       status = link (current_link_name, CURRENT_FILE_NAME);
+       status = link (current_link_name + skiplinkcrud, CURRENT_FILE_NAME);
 
        if (status == 0)
          break;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]