diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-04-03 09:34:28 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-04-03 09:34:29 -0700 |
commit | b9c78e97237df7df45549d29755e51b4a0fdc5ea (patch) | |
tree | 2bc749c7d16c66bfd3289f8813a7395c2867f509 /entry.c | |
parent | a70f4cb5b06856d5999352930b97fdfc96105954 (diff) | |
parent | d3b34622f699ff14646de4ec1b1ab9afb0bcb056 (diff) | |
download | git-b9c78e97237df7df45549d29755e51b4a0fdc5ea.tar.gz |
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
Diffstat (limited to 'entry.c')
-rw-r--r-- | entry.c | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -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; } |