From: François Pinard Date: Wed, 16 Nov 1994 02:43:31 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=8d5c4b8415097dd2ecefafe95ef21bca6df14916;p=chaz%2Ftar *** empty log message *** --- diff --git a/src/create.c b/src/create.c index 1bc82be..16906f7 100644 --- a/src/create.c +++ b/src/create.c @@ -534,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++; @@ -1055,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; } @@ -1105,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; diff --git a/src/port.c b/src/port.c index 2f3c282..c45ee3a 100644 --- a/src/port.c +++ b/src/port.c @@ -177,14 +177,22 @@ rename (from, to) { 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 diff --git a/src/version.c b/src/version.c index eaa5152..5b11cea 100644 --- a/src/version.c +++ b/src/version.c @@ -17,4 +17,4 @@ You should have received a copy of the GNU General Public License 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";