tar: return correct error for short read of tar archive
parent
ce72c8498e
commit
ca368916e0
|
@ -109,8 +109,13 @@ static ssize_t tar_entry_read(void *stream, void *ptr, size_t size)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
r = teis->tar_is->read(teis->tar_is, ptr, size);
|
r = teis->tar_is->read(teis->tar_is, ptr, size);
|
||||||
if (r < 0)
|
if (r <= 0) {
|
||||||
|
/* If inner stream returned zero (end-of-stream), we
|
||||||
|
* are getting short read, because tar header indicated
|
||||||
|
* more was to be expected. */
|
||||||
|
if (r == 0) return -ECONNABORTED;
|
||||||
return r;
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
teis->bytes_left -= r;
|
teis->bytes_left -= r;
|
||||||
if (teis->csum == NULL)
|
if (teis->csum == NULL)
|
||||||
|
|
Loading…
Reference in New Issue