summaryrefslogtreecommitdiffstats
path: root/crypto/rand/randfile.c
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2000-01-21 17:11:26 +0000
committerBodo Möller <bodo@openssl.org>2000-01-21 17:11:26 +0000
commit674b8eec4c5992714fd98389c90534c215000d75 (patch)
treec85ddfbf484a774353a0f0fecf82278c91b05a5d /crypto/rand/randfile.c
parent033db22d57bbe82e80d7e88c526daba008553d86 (diff)
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).
Diffstat (limited to 'crypto/rand/randfile.c')
-rw-r--r--crypto/rand/randfile.c2
1 files changed, 2 insertions, 0 deletions
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: