From: Bodo Möller Date: Fri, 21 Jan 2000 17:11:26 +0000 (+0000) Subject: In RAND_write_file, truncate the file to the no. of bytes written X-Git-Tag: OpenSSL_0_9_5beta1~231 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=674b8eec4c5992714fd98389c90534c215000d75;p=oweals%2Fopenssl.git In RAND_write_file, truncate the file to the no. of bytes written (we're now using fopen(..., "rb+") instead of fopen(..., "wb"), so the file is not truncated automatically). --- diff --git a/crypto/rand/randfile.c b/crypto/rand/randfile.c index f95ecb0e00..cf98643d3c 100644 --- a/crypto/rand/randfile.c +++ b/crypto/rand/randfile.c @@ -167,6 +167,8 @@ int RAND_write_file(const char *file) ret+=i; if (n <= 0) break; } + if (ret > 0) + ftruncate(fileno(out), ret); fclose(out); memset(buf,0,BUFSIZE); err: