diff options
author | kientzle <kientzle@FreeBSD.org> | 2005-11-01 06:41:05 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2005-11-01 06:41:05 +0000 |
commit | b3577bdc654b444cf5278d5e25d6d1234df68f60 (patch) | |
tree | 83693408b3412dbe29059ecec6aaa60a00bfd27b /usr.bin | |
parent | 2c6448ce6d1851408401481a4065f52658916af4 (diff) | |
download | FreeBSD-src-b3577bdc654b444cf5278d5e25d6d1234df68f60.zip FreeBSD-src-b3577bdc654b444cf5278d5e25d6d1234df68f60.tar.gz |
In mode 'u', check for an error return from archive_read_open.
This causes attempts to update a non-existent file to report
an actual error instead of triggering an assertion failure.
PR: bin/87911
Thanks to: roemer.ulrich
MFC after: 3 days
Note: This does not entirely fix bin/87911. I need to decide on
the "correct" response when someone tries to update a non-existent
archive file.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tar/write.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/tar/write.c b/usr.bin/tar/write.c index 6a78df5..e283ebe 100644 --- a/usr.bin/tar/write.c +++ b/usr.bin/tar/write.c @@ -296,9 +296,13 @@ tar_mode_u(struct bsdtar *bsdtar) archive_read_support_compression_all(a); archive_read_support_format_tar(a); archive_read_support_format_gnutar(a); - archive_read_open_fd(a, bsdtar->fd, + if (archive_read_open_fd(a, bsdtar->fd, bsdtar->bytes_per_block != 0 ? bsdtar->bytes_per_block : - DEFAULT_BYTES_PER_BLOCK); + DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) { + bsdtar_errc(bsdtar, 1, archive_errno(a), + "Can't open %s: %s", bsdtar->filename, + archive_error_string(a)); + } /* Build a list of all entries and their recorded mod times. */ while (0 == archive_read_next_header(a, &entry)) { |