diff --git a/crypto/rand/randfile.c b/crypto/rand/randfile.c index 1882d7df2cb4a6c683f764a0dac8c77facaa1637..375c339e5c3c6b5776f44afafa5e0a09754cd9ab 100644 --- a/crypto/rand/randfile.c +++ b/crypto/rand/randfile.c @@ -162,6 +162,13 @@ int RAND_write_file(const char *file) ret+=i; if (n <= 0) break; } +#ifdef VMS + /* We may have updated an existing file using mode "rb+", + * now remove any old extra bytes */ + if (ret > 0) + ftruncate(fileno(out), ret); +#endif + fclose(out); memset(buf,0,BUFSIZE); err: