mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-28 06:52:45 +00:00
Catch decompression failures earlier. In particular, this gives
immediate feedback if we fail to fork an external decompression program.
This commit is contained in:
parent
e2196d3e85
commit
dee0ce0cbd
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=201157
@ -354,6 +354,7 @@ build_stream(struct archive_read *a)
|
||||
int number_bidders, i, bid, best_bid;
|
||||
struct archive_read_filter_bidder *bidder, *best_bidder;
|
||||
struct archive_read_filter *filter;
|
||||
ssize_t avail;
|
||||
int r;
|
||||
|
||||
for (;;) {
|
||||
@ -392,6 +393,13 @@ build_stream(struct archive_read *a)
|
||||
free(filter);
|
||||
return (r);
|
||||
}
|
||||
/* Verify the filter by asking it for some data. */
|
||||
__archive_read_filter_ahead(filter, 1, &avail);
|
||||
if (avail < 0) {
|
||||
/* If the read failed, bail out now. */
|
||||
free(filter);
|
||||
return (avail);
|
||||
}
|
||||
a->filter = filter;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user