bug-tar
[Top][All Lists]
Advanced

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

Re: [Bug-tar] hard links and --transform


From: Sergey Poznyakoff
Subject: Re: [Bug-tar] hard links and --transform
Date: Thu, 30 Jul 2009 11:05:55 +0300

Hi Jose,

Sorry that it took me so long to reply.

> But, when I give 'H' in the transformation scope flag it still does
> the transformation:

The following patch fixes this as well.

Regards,
Sergey

diff --git a/src/create.c b/src/create.c
index a925160..245b6c3 100644
--- a/src/create.c
+++ b/src/create.c
@@ -1427,19 +1427,26 @@ file_count_links (struct tar_stat_info *st)
   if (st->stat.st_nlink > 1)
     {
       struct link *duplicate;
-      struct link *lp = xmalloc (offsetof (struct link, name)
-                                + strlen (st->orig_file_name) + 1);
+      char *linkname = NULL;
+      struct link *lp;
+
+      assign_string (&linkname, st->orig_file_name);
+      transform_name (&linkname, XFORM_LINK);
+      
+      lp = xmalloc (offsetof (struct link, name)
+                                + strlen (linkname) + 1);
       lp->ino = st->stat.st_ino;
       lp->dev = st->stat.st_dev;
       lp->nlink = st->stat.st_nlink;
-      strcpy (lp->name, st->orig_file_name);
-
+      strcpy (lp->name, linkname);
+      free (linkname);
+      
       if (! ((link_table
              || (link_table = hash_initialize (0, 0, hash_link,
                                                compare_links, 0)))
             && (duplicate = hash_insert (link_table, lp))))
        xalloc_die ();





reply via email to

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