Merge branch 'jk/write-in-full-fix'
Many codepaths did not diagnose write failures correctly when disks go full, due to their misuse of write_in_full() helper function, which have been corrected. * jk/write-in-full-fix: read_pack_header: handle signed/unsigned comparison in read result config: flip return value of store_write_*() notes-merge: use ssize_t for write_in_full() return value pkt-line: check write_in_full() errors against "< 0" convert less-trivial versions of "write_in_full() != len" avoid "write_in_full(fd, buf, len) != len" pattern get-tar-commit-id: check write_in_full() return against 0 config: avoid "write_in_full(fd, buf, len) < len" pattern
This commit is contained in:
@ -1922,7 +1922,7 @@ static int ce_write_flush(git_SHA_CTX *context, int fd)
|
||||
unsigned int buffered = write_buffer_len;
|
||||
if (buffered) {
|
||||
git_SHA1_Update(context, write_buffer, buffered);
|
||||
if (write_in_full(fd, write_buffer, buffered) != buffered)
|
||||
if (write_in_full(fd, write_buffer, buffered) < 0)
|
||||
return -1;
|
||||
write_buffer_len = 0;
|
||||
}
|
||||
@ -1971,7 +1971,7 @@ static int ce_flush(git_SHA_CTX *context, int fd, unsigned char *sha1)
|
||||
|
||||
/* Flush first if not enough space for SHA1 signature */
|
||||
if (left + 20 > WRITE_BUFFER_SIZE) {
|
||||
if (write_in_full(fd, write_buffer, left) != left)
|
||||
if (write_in_full(fd, write_buffer, left) < 0)
|
||||
return -1;
|
||||
left = 0;
|
||||
}
|
||||
@ -1980,7 +1980,7 @@ static int ce_flush(git_SHA_CTX *context, int fd, unsigned char *sha1)
|
||||
git_SHA1_Final(write_buffer + left, context);
|
||||
hashcpy(sha1, write_buffer + left);
|
||||
left += 20;
|
||||
return (write_in_full(fd, write_buffer, left) != left) ? -1 : 0;
|
||||
return (write_in_full(fd, write_buffer, left) < 0) ? -1 : 0;
|
||||
}
|
||||
|
||||
static void ce_smudge_racily_clean_entry(struct cache_entry *ce)
|
||||
|
||||
Reference in New Issue
Block a user