X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fextract.c;h=e859c169dfdfc0e51d98acbdd2c67dcd297225a7;hb=6dccec3ba45c8c5052be0dacb7c4766662ed30fc;hp=27e6e583eaf345adc589f685889f4e164a0674b4;hpb=bda50f104bc88c4bcf576c34a7c8d2719fed71ba;p=chaz%2Ftar diff --git a/src/extract.c b/src/extract.c index 27e6e58..e859c16 100644 --- a/src/extract.c +++ b/src/extract.c @@ -249,16 +249,6 @@ make_directories (char *file_name) if (status == 0) { - /* Fix ownership. */ - - if (we_are_root) - if (chown (file_name, current_stat.st_uid, current_stat.st_gid) < 0) - ERROR ((0, errno, - _("%s: Cannot change owner to uid %lu, gid %lu"), - file_name, - (unsigned long) current_stat.st_uid, - (unsigned long) current_stat.st_gid)); - print_for_mkdir (file_name, cursor - file_name, ~newdir_umask & MODE_RWX); did_something = 1; @@ -377,6 +367,11 @@ extract_sparse_file (int fd, off_t *sizeleft, off_t totalsize, char *name) *sizeleft -= count; set_next_block_after (data_block); data_block = find_next_block (); + if (! data_block) + { + ERROR ((0, 0, _("Unexpected EOF on archive file"))); + return; + } } count = full_write (fd, data_block->buffer, written); @@ -517,6 +512,11 @@ extract_archive (void) while (1) { exhdr = find_next_block (); + if (! exhdr) + { + ERROR ((0, 0, _("Unexpected EOF on archive file"))); + return; + } for (counter = 0; counter < SPARSES_IN_SPARSE_HEADER; counter++) { if (counter + ind > sp_array_size - 1) @@ -529,9 +529,7 @@ extract_archive (void) xrealloc (sparsearray, sp_array_size * (sizeof (struct sp_array))); } - /* Compare to 0, or use !(int)..., for Pyramid's dumb - compiler. */ - if (exhdr->sparse_header.sp[counter].numbytes == 0) + if (exhdr->sparse_header.sp[counter].numbytes[0] == 0) break; sparsearray[counter + ind].offset = OFF_FROM_CHARS (exhdr->sparse_header.sp[counter].offset); @@ -760,8 +758,8 @@ extract_archive (void) if (!warned_once) { warned_once = 1; - WARN ((0, 0, _("\ -Attempting extraction of symbolic links as hard links"))); + WARN ((0, 0, + _("Attempting extraction of symbolic links as hard links"))); } } /* Fall through. */ @@ -981,8 +979,8 @@ Attempting extraction of symbolic links as hard links"))); break; case GNUTYPE_MULTIVOL: - ERROR ((0, 0, _("\ -Cannot extract `%s' -- file is continued from another volume"), + ERROR ((0, 0, + _("Cannot extract `%s' -- file is continued from another volume"), current_file_name)); skip_file (current_stat.st_size); if (backup_option)