]> Dogcows Code - chaz/tar/commitdiff
(read_header): Minor change.
authorSergey Poznyakoff <gray@gnu.org.ua>
Thu, 4 Sep 2003 13:59:03 +0000 (13:59 +0000)
committerSergey Poznyakoff <gray@gnu.org.ua>
Thu, 4 Sep 2003 13:59:03 +0000 (13:59 +0000)
src/list.c

index e5e187f2a78ea332328217f51f6c2a43d3834c41..5b06e80ecb9b7a27115fb5e5154934d25170918c 100644 (file)
@@ -320,72 +320,72 @@ read_header (bool raw_extended_headers)
 
       /* Good block.  Decode file size and return.  */
 
-      if (header->header.typeflag == XHDTYPE
-         || header->header.typeflag == XGLTYPE)
-       {
-         xheader_read (header, OFF_FROM_HEADER (header->header.size));
-         continue;
-       }
-      
       if (header->header.typeflag == LNKTYPE)
        current_stat_info.stat.st_size = 0;     /* links 0 size on tape */
       else
        current_stat_info.stat.st_size = OFF_FROM_HEADER (header->header.size);
 
       if (header->header.typeflag == GNUTYPE_LONGNAME
-         || header->header.typeflag == GNUTYPE_LONGLINK)
+         || header->header.typeflag == GNUTYPE_LONGLINK
+         || header->header.typeflag == XHDTYPE
+         || header->header.typeflag == XGLTYPE)
        {
          if (raw_extended_headers)
            return HEADER_SUCCESS_EXTENDED;
-         else
+         else if (header->header.typeflag == GNUTYPE_LONGNAME
+                  || header->header.typeflag == GNUTYPE_LONGLINK)
            {
              size_t name_size = current_stat_info.stat.st_size;
              size = name_size - name_size % BLOCKSIZE + 2 * BLOCKSIZE;
-             if (name_size != current_stat_info.stat.st_size || size < name_size)
+             if (name_size != current_stat_info.stat.st_size
+                 || size < name_size)
                xalloc_die ();
-           }
-
-         header_copy = xmalloc (size + 1);
 
-         if (header->header.typeflag == GNUTYPE_LONGNAME)
-           {
-             if (next_long_name)
-               free (next_long_name);
-             next_long_name = header_copy;
-             next_long_name_blocks = size / BLOCKSIZE;
-           }
-         else
-           {
-             if (next_long_link)
-               free (next_long_link);
-             next_long_link = header_copy;
-             next_long_link_blocks = size / BLOCKSIZE;
-           }
-
-         set_next_block_after (header);
-         *header_copy = *header;
-         bp = header_copy->buffer + BLOCKSIZE;
-
-         for (size -= BLOCKSIZE; size > 0; size -= written)
-           {
-             data_block = find_next_block ();
-             if (! data_block)
+             header_copy = xmalloc (size + 1);
+             
+             if (header->header.typeflag == GNUTYPE_LONGNAME)
                {
-                 ERROR ((0, 0, _("Unexpected EOF in archive")));
-                 break;
+                 if (next_long_name)
+                   free (next_long_name);
+                 next_long_name = header_copy;
+                 next_long_name_blocks = size / BLOCKSIZE;
                }
-             written = available_space_after (data_block);
-             if (written > size)
-               written = size;
-
-             memcpy (bp, data_block->buffer, written);
-             bp += written;
-             set_next_block_after ((union block *)
-                                   (data_block->buffer + written - 1));
-           }
+             else
+               {
+                 if (next_long_link)
+                   free (next_long_link);
+                 next_long_link = header_copy;
+                 next_long_link_blocks = size / BLOCKSIZE;
+               }
+             
+             set_next_block_after (header);
+             *header_copy = *header;
+             bp = header_copy->buffer + BLOCKSIZE;
 
-         *bp = '\0';
+             for (size -= BLOCKSIZE; size > 0; size -= written)
+               {
+                 data_block = find_next_block ();
+                 if (! data_block)
+                   {
+                     ERROR ((0, 0, _("Unexpected EOF in archive")));
+                     break;
+                   }
+                 written = available_space_after (data_block);
+                 if (written > size)
+                   written = size;
+                 
+                 memcpy (bp, data_block->buffer, written);
+                 bp += written;
+                 set_next_block_after ((union block *)
+                                       (data_block->buffer + written - 1));
+               }
 
+             *bp = '\0';
+           }
+         else if (header->header.typeflag == XHDTYPE
+                  || header->header.typeflag == XGLTYPE)
+           xheader_read (header, OFF_FROM_HEADER (header->header.size));
+      
          /* Loop!  */
 
        }
This page took 0.028515 seconds and 4 git commands to generate.