Under VMS, ftruncate should be available
authorBodo Möller <bodo@openssl.org>
Sun, 23 Jan 2000 22:02:34 +0000 (22:02 +0000)
committerBodo Möller <bodo@openssl.org>
Sun, 23 Jan 2000 22:02:34 +0000 (22:02 +0000)
crypto/rand/randfile.c

index 1882d7df2cb4a6c683f764a0dac8c77facaa1637..375c339e5c3c6b5776f44afafa5e0a09754cd9ab 100644 (file)
@@ -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: