summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2011-06-06 00:25:44 +0000
committerChristopher Faylor <me@cgf.cx>2011-06-06 00:25:44 +0000
commitdaf7238603ffb7ed994ee492ed63620f6f919835 (patch)
tree7dafedec5ab0eeaca5e4e4ae410502d0a8a55f83 /winsup/cygwin
parentd5cb221b85cc8120c0947d74178f762c84d47a96 (diff)
downloadcygnal-daf7238603ffb7ed994ee492ed63620f6f919835.tar.gz
cygnal-daf7238603ffb7ed994ee492ed63620f6f919835.tar.bz2
cygnal-daf7238603ffb7ed994ee492ed63620f6f919835.zip
* fhandler_disk_file.cc (fhandler_disk_file::pread): Reset windows file
position pointer back to previous location after successful read.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc6
2 files changed, 10 insertions, 1 deletions
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 <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>
* 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);