]> Dogcows Code - chaz/tar/blobdiff - src/create.c
*** empty log message ***
[chaz/tar] / src / create.c
index 0bf8a70733d483c20d8a593553a2e5038b45dc5f..16906f73e2faa32e19ea0063365f260824afece8 100644 (file)
@@ -1,5 +1,5 @@
 /* Create a tar archive.
-   Copyright (C) 1985, 1992 Free Software Foundation
+   Copyright (C) 1985, 1992, 1993 Free Software Foundation
 
 This file is part of GNU Tar.
 
@@ -170,10 +170,8 @@ create_archive ()
     }
   else
     {
-      p = name_next (1);
-      do
+      while (p = name_next (1))
        dump_file (p, -1, 1);
-      while (p = name_next (1));
     }
 
   write_eot ();
@@ -345,7 +343,7 @@ dump_file (p, curdev, toplevel)
        }
 
       /* Not found.  Add it to the list of possible links. */
-      lp = (struct link *) malloc ((unsigned) (sizeof (struct link) + strlen (p)));
+      lp = (struct link *) ck_malloc ((unsigned) (sizeof (struct link) + strlen (p)));
       if (!lp)
        {
          if (!nolinks)
@@ -536,7 +534,7 @@ dump_file (p, curdev, toplevel)
          /*                    sum += i;
                        if (sum < upperbound)
                                goto extend;*/
-         if (index_offset + i < upperbound)
+         if (index_offset + i <= upperbound)
            {
              index_offset += i;
              exhdr->ext_hdr.isextended++;
@@ -992,7 +990,7 @@ init_sparsearray ()
   /*
         * Make room for our scratch space -- initially is 10 elts long
         */
-  sparsearray = (struct sp_array *) malloc (sp_array_size * sizeof (struct sp_array));
+  sparsearray = (struct sp_array *) ck_malloc (sp_array_size * sizeof (struct sp_array));
   for (i = 0; i < sp_array_size; i++)
     {
       sparsearray[i].offset = 0;
@@ -1057,7 +1055,7 @@ deal_with_sparse (name, header, nulls_at_end)
                 * realloc the scratch area, since we've run out of room --
                 */
          sparsearray = (struct sp_array *)
-           realloc (sparsearray,
+           ck_realloc (sparsearray,
                     2 * sp_array_size * (sizeof (struct sp_array)));
          sp_array_size *= 2;
        }
@@ -1107,6 +1105,11 @@ deal_with_sparse (name, header, nulls_at_end)
     }
   if (amidst_data)
     sparsearray[sparse_ind++].numbytes = numbytes;
+  else
+    {
+      sparsearray[sparse_ind].offset = offset-1;
+      sparsearray[sparse_ind++].numbytes = 1;
+    }
   close (fd);
 
   return sparse_ind - 1;
This page took 0.023287 seconds and 4 git commands to generate.