Merge branch 'jk/check-corrupt-objects-carefully'
Have the streaming interface and other codepaths more carefully examine for corrupt objects. * jk/check-corrupt-objects-carefully: clone: leave repo in place after checkout errors clone: run check_everything_connected clone: die on errors from unpack_trees add tests for cloning corrupted repositories streaming_write_entry: propagate streaming errors add test for streaming corrupt blobs avoid infinite loop in read_istream_loose read_istream_filtered: propagate read error from upstream check_sha1_signature: check return value from read_istream stream_blob_to_fd: detect errors reading from stream
This commit is contained in:
16
entry.c
16
entry.c
@ -120,16 +120,18 @@ static int streaming_write_entry(struct cache_entry *ce, char *path,
|
||||
const struct checkout *state, int to_tempfile,
|
||||
int *fstat_done, struct stat *statbuf)
|
||||
{
|
||||
int result = -1;
|
||||
int result = 0;
|
||||
int fd;
|
||||
|
||||
fd = open_output_fd(path, ce, to_tempfile);
|
||||
if (0 <= fd) {
|
||||
result = stream_blob_to_fd(fd, ce->sha1, filter, 1);
|
||||
*fstat_done = fstat_output(fd, state, statbuf);
|
||||
result = close(fd);
|
||||
}
|
||||
if (result && 0 <= fd)
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
|
||||
result |= stream_blob_to_fd(fd, ce->sha1, filter, 1);
|
||||
*fstat_done = fstat_output(fd, state, statbuf);
|
||||
result |= close(fd);
|
||||
|
||||
if (result)
|
||||
unlink(path);
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user