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 1882d7d..375c339 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: