/* sum += i;
if (sum < upperbound)
goto extend;*/
- if (index_offset + i < upperbound)
+ if (index_offset + i <= upperbound)
{
index_offset += i;
exhdr->ext_hdr.isextended++;
* 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;
}
}
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;
{
struct stat from_stats;
- if (stat (from, &from_stats) == 0)
+ if (stat (from, &from_stats))
+ return -1;
+
+ if (unlink (to) && errno != ENOENT)
+ return -1;
+
+ if (link (from, to))
+ return -1;
+
+ if (unlink (from) && errno != ENOENT)
{
- if (unlink (to) && errno != ENOENT)
- return -1;
- if (link (from, to) == 0 && (unlink (from) == 0 || errno == ENOENT))
- return 0;
+ unlink (to);
+ return -1;
}
- return -1;
+
+ return 0;
}
#endif
along with GNU Tar; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-char version_string[] = "GNU tar version 1.10.14";
+char version_string[] = "GNU tar version 1.10.15";