diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 1f8f5d5c6..add882874 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2011-06-05 Christopher Faylor + + * 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 * fhandler_console.cc (fhandler_console::open_shared_console): Don't diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index b491fd34f..d7d63b1d5 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1448,7 +1448,7 @@ fhandler_disk_file::pread (void *buf, size_t count, _off64_t offset) status = NtReadFile (get_handle (), NULL, NULL, NULL, &io, buf, count, &off, NULL); if (NT_SUCCESS (status)) - return io.Information; + goto success; break; case MMAP_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); return -1; } + +success: + lseek (-io.Information, SEEK_CUR); return io.Information; } + /* Text mode stays slow and non-atomic. */ ssize_t res; _off64_t curpos = lseek (0, SEEK_CUR);