From 674b8eec4c5992714fd98389c90534c215000d75 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bodo=20M=C3=B6ller?= Date: Fri, 21 Jan 2000 17:11:26 +0000 Subject: [PATCH] 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). --- crypto/rand/randfile.c | 2 ++ 1 file changed, 2 insertions(+) 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: -- 2.25.1