提交 eaf29cc8 编写于 作者: E Enrico Giordani

Truncate AOF in case of unexpected EOF.

The Win32 port was not truncating the AOF file.
上级 91d01bf8
......@@ -679,7 +679,7 @@ int truncate(const char *path, PORT_LONGLONG length) {
toTruncate = CreateFileA(path, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_WRITE | FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
if (toTruncate != INVALID_HANDLE_VALUE) {
newSize.QuadPart = length;
if (FALSE == SetFilePointerEx(toTruncate, newSize, NULL, FILE_BEGIN)) {
if (FALSE == (SetFilePointerEx(toTruncate, newSize, NULL, FILE_BEGIN) && SetEndOfFile(toTruncate))) {
errno = ENOENT;
return -1;
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册