Commit 674b8eec authored by Bodo Möller's avatar Bodo Möller
Browse files

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).
parent 033db22d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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: