]> git.ipfire.org Git - thirdparty/tar.git/commit - src/delete.c
Avoid excess lseek etc.
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 14 Aug 2022 23:32:26 +0000 (16:32 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 15 Aug 2022 07:07:39 +0000 (00:07 -0700)
commit66be5a789e70f911170017754fc51e499998f90e
tree21faa71070e63be3bb9994a8daf0c8de8477ae1f
parentbadd509078d97c248b21d875dd239455887cfa0e
Avoid excess lseek etc.

* src/buffer.c, src/delete.c: Do not include system-ioctl.h.
* src/buffer.c (guess_seekable_archive): Remove.  This is now done
by get_archive_status, in a different way.
(get_archive_status): New function that gets archive_stat
unless remote, and sets seekable_archive etc.
(_open_archive): Prefer bool for boolean.
(_open_archive, new_volume): Get archive status consistently
by calling get_archive_status in both places.
* src/buffer.c (backspace_output):
* src/compare.c (verify_volume):
* src/delete.c (move_archive):
Let mtioseek worry about mtio.
* src/common.h (archive_stat): New global, replacing ar_dev and
ar_ino.  All uses changed.
* src/delete.c (move_archive): Check for integer overflow.
Also report overflow if the archive position would go negative.
* src/system.c: Include system-ioctl.h, for MTIOCTOP etc.
(mtioseek): New function, which also checks for integer overflow.
(sys_save_archive_dev_ino): Remove.
(archive_stat): Now
(sys_get_archive_stat): Also initialize mtioseekable_archive.
(sys_file_is_archive): Don’t return true if the archive is /dev/null
since it’s not a problem in that case.
(sys_detect_dev_null_output): Cache dev_null_stat.

doc: omit MS-DOS mentions in doc
It’s really FAT32 we’re worried about now, not MS-DOS.
And doschk is no longer a GNU program.
src/buffer.c
src/common.h
src/compare.c
src/delete.c
src/system.c