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

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

Re: tar 1.13.24


From: Paul Eggert
Subject: Re: tar 1.13.24
Date: Wed, 26 Sep 2001 13:20:55 -0700 (PDT)

> From: christian laubscher <address@hidden>
> Date: Wed, 26 Sep 2001 18:39:46 +0200
> 
> using the 1.13.24, i have a problem with archive listings (see att 
> list24 (just an excerpt).

Thanks for the bug report.  Please try the following patch.

2001-09-26  Paul Eggert  <address@hidden>

        * src/list.c (read_header): Don't keep around extended name
        and link info indefinitely; keep it only for the next file.
        This fixes a bug introduced in 1.13.24, and removes the need
        for some static variables.  Set recent_long_name and
        recent_long_link to zero if there were no long links; this
        avoids a violation of ANSI C rules for pointers in delete.c.

===================================================================
RCS file: src/list.c,v
retrieving revision 1.12.0.33
retrieving revision 1.12.0.34
diff -pu -r1.12.0.33 -r1.12.0.34
--- src/list.c  2001/09/23 06:18:20     1.12.0.33
+++ src/list.c  2001/09/26 20:15:52     1.12.0.34
@@ -268,14 +268,14 @@ read_header (bool raw_extended_headers)
   uintmax_t parsed_sum;
   char *p;
   union block *header;
-  union block **longp;
+  union block *header_copy;
   char *bp;
   union block *data_block;
   size_t size, written;
-  static union block *next_long_name;
-  static union block *next_long_link;
-  static size_t next_long_name_blocks;
-  static size_t next_long_link_blocks;
+  union block *next_long_name = 0;
+  union block *next_long_link = 0;
+  size_t next_long_name_blocks;
+  size_t next_long_link_blocks;
 
   while (1)
     {
@@ -338,23 +338,26 @@ read_header (bool raw_extended_headers)
                xalloc_die ();
            }
 
+         header_copy = xmalloc (size + 1);
+
          if (header->header.typeflag == GNUTYPE_LONGNAME)
            {
-             longp = &next_long_name;
+             if (next_long_name)
+               free (next_long_name);
+             next_long_name = header_copy;
              next_long_name_blocks = size / BLOCKSIZE;
            }
          else
            {
-             longp = &next_long_link;
+             if (next_long_link)
+               free (next_long_link);
+             next_long_link = header_copy;
              next_long_link_blocks = size / BLOCKSIZE;
            }
 
          set_next_block_after (header);
-         if (*longp)
-           free (*longp);
-         *longp = xmalloc (size + 1);
-         **longp = *header;
-         bp = (*longp)->buffer + BLOCKSIZE;
+         *header_copy = *header;
+         bp = header_copy->buffer + BLOCKSIZE;
 
          for (size -= BLOCKSIZE; size > 0; size -= written)
            {
@@ -385,6 +388,9 @@ read_header (bool raw_extended_headers)
          struct posix_header const *h = &current_header->header;
          char namebuf[sizeof h->prefix + 1 + NAME_FIELD_SIZE + 1];
 
+         if (recent_long_name)
+           free (recent_long_name);
+
          if (next_long_name)
            {
              name = next_long_name->buffer + BLOCKSIZE;
@@ -412,10 +418,14 @@ read_header (bool raw_extended_headers)
              memcpy (np, h->name, sizeof h->name);
              np[sizeof h->name] = '\0';
              name = namebuf;
+             recent_long_name = 0;
              recent_long_name_blocks = 0;
            }
          assign_string (&current_file_name, name);
-         
+
+         if (recent_long_link)
+           free (recent_long_link);
+
          if (next_long_link)
            {
              name = next_long_link->buffer + BLOCKSIZE;
@@ -427,6 +437,7 @@ read_header (bool raw_extended_headers)
              memcpy (namebuf, h->linkname, sizeof h->linkname);
              namebuf[sizeof h->linkname] = '\0';
              name = namebuf;
+             recent_long_link = 0;
              recent_long_link_blocks = 0;
            }
          assign_string (&current_link_name, name);



reply via email to

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