]> Dogcows Code - chaz/tar/commitdiff
Support for "linkpath" extended keyword
authorSergey Poznyakoff <gray@gnu.org.ua>
Thu, 4 Sep 2003 09:37:05 +0000 (09:37 +0000)
committerSergey Poznyakoff <gray@gnu.org.ua>
Thu, 4 Sep 2003 09:37:05 +0000 (09:37 +0000)
src/create.c

index a0c76289e3cc773d33678910344c87fd7009c12d..b0fa1e88facdf16e8ebe5b9d10bda4e71d6fc580 100644 (file)
@@ -402,6 +402,16 @@ write_long (const char *p, char type)
   set_next_block_after (header + (size - 1) / BLOCKSIZE);
 }
 
+/* Write a long link name, depending on the current archive format */
+static void
+write_long_link (struct tar_stat_info *st)
+{
+  if (archive_format == POSIX_FORMAT)
+    xheader_store ("linkpath", st);
+  else
+    write_long (st->link_name, GNUTYPE_LONGNAME);
+}
+
 /* NOTE: Cross recursion between start_header and write_extended  */
 
 static union block *
@@ -1245,9 +1255,9 @@ dump_file (char *p, int top_level, dev_t parent_device)
              dup->nlink--;
              
              block_ordinal = current_block_ordinal ();
-             if (NAME_FIELD_SIZE <= strlen (link_name))
-               write_long (link_name, GNUTYPE_LONGLINK);
              assign_string (&current_stat_info.link_name, link_name);
+             if (NAME_FIELD_SIZE <= strlen (link_name))
+               write_long_link (&current_stat_info);
 
              current_stat_info.stat.st_size = 0;
              header = start_header (p, &current_stat_info);
@@ -1572,9 +1582,9 @@ dump_file (char *p, int top_level, dev_t parent_device)
              return;
            }
          buffer[size] = '\0';
-         if (size >= NAME_FIELD_SIZE)
-           write_long (buffer, GNUTYPE_LONGLINK);
          assign_string (&current_stat_info.link_name, buffer);
+         if (size >= NAME_FIELD_SIZE)
+           write_long_link (&current_stat_info);
 
          block_ordinal = current_block_ordinal ();
          current_stat_info.stat.st_size = 0;   /* force 0 size on symlink */
This page took 0.023963 seconds and 4 git commands to generate.