X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=read-cache.c;h=6eff4c8401b820b001a3ed48e8086c4cf1cd8f5c;hb=2aba319a52b3601cff3f32b60bc28023ee45575d;hp=ced597318e783ab08b73c88f8b724be51f3b3dec;hpb=379955c696a417f0fb6118f2fd91dbffd2816ad1;p=git.git diff --git a/read-cache.c b/read-cache.c index ced59731..6eff4c84 100644 --- a/read-cache.c +++ b/read-cache.c @@ -462,6 +462,13 @@ static int ce_flush(SHA_CTX *context, int fd) SHA1_Update(context, write_buffer, left); } + /* Flush first if not enough space for SHA1 signature */ + if (left + 20 > WRITE_BUFFER_SIZE) { + if (write(fd, write_buffer, left) != left) + return -1; + left = 0; + } + /* Append the SHA1 signature at the end */ SHA1_Final(write_buffer + left, context); left += 20;