* fhandler_disk_file.cc (fhandler_disk_file::pread): Reset windows file

position pointer back to previous location after successful read.
This commit is contained in:
Christopher Faylor 2011-06-06 00:25:44 +00:00
parent d5cb221b85
commit daf7238603
2 changed files with 10 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2011-06-05 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler_disk_file.cc (fhandler_disk_file::pread): Reset windows file
position pointer back to previous location after successful read.
2011-06-04 Christopher Faylor <me.cygwin2011@cgf.cx> 2011-06-04 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler_console.cc (fhandler_console::open_shared_console): Don't * fhandler_console.cc (fhandler_console::open_shared_console): Don't

View File

@ -1448,7 +1448,7 @@ fhandler_disk_file::pread (void *buf, size_t count, _off64_t offset)
status = NtReadFile (get_handle (), NULL, NULL, NULL, &io, status = NtReadFile (get_handle (), NULL, NULL, NULL, &io,
buf, count, &off, NULL); buf, count, &off, NULL);
if (NT_SUCCESS (status)) if (NT_SUCCESS (status))
return io.Information; goto success;
break; break;
case MMAP_RAISE_SIGBUS: case MMAP_RAISE_SIGBUS:
raise (SIGBUS); raise (SIGBUS);
@ -1459,8 +1459,12 @@ fhandler_disk_file::pread (void *buf, size_t count, _off64_t offset)
__seterrno_from_nt_status (status); __seterrno_from_nt_status (status);
return -1; return -1;
} }
success:
lseek (-io.Information, SEEK_CUR);
return io.Information; return io.Information;
} }
/* Text mode stays slow and non-atomic. */ /* Text mode stays slow and non-atomic. */
ssize_t res; ssize_t res;
_off64_t curpos = lseek (0, SEEK_CUR); _off64_t curpos = lseek (0, SEEK_CUR);