This commit is contained in:
manojampalam 2016-03-05 20:11:05 -08:00
parent b6545a7e39
commit 0b3db0aa3e
1 changed files with 3 additions and 2 deletions

View File

@ -328,8 +328,9 @@ fileio_read(struct w32_io* pio, void *dst, unsigned int max) {
/* Workaround for - ReadFileEx is restting file pointer to beginning upon encoutering a EOF*/
/* If there was a previous read and if the file pointer is at 0, then its been reset*/
if ((pio->type == FILE_FD) && (pio->read_details.completed > 0)){
DWORD fp = SetFilePointer(pio->handle, 0, NULL, FILE_CURRENT);
if (fp == 0) {
LARGE_INTEGER to_move, new_fp;
to_move.QuadPart = 0;
if (SetFilePointerEx(pio->handle, to_move, &new_fp, FILE_CURRENT) && (new_fp.QuadPart == 0)) {
errno = 0;
return 0;
}