Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2007-05-21 13:11:27 +0400
committerCorinna Vinschen <corinna@vinschen.de>2007-05-21 13:11:27 +0400
commitb7a37e8d7cb7cbd6fc650b9b1c538a5e87032f0b (patch)
treebbf86342e601bee778c30ca2607cc691ba96a76e
parent2c656a51c9b0d619ec2479ca925c14c3a59d19ce (diff)
* fhandler_floppy.cc (fhandler_dev_floppy::lseek): Set buf size to
sector size. Simplify non-sector aligned case. Handle errors from raw_read.
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/fhandler_floppy.cc10
2 files changed, 13 insertions, 4 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 9da3832f3..f9f4aeab0 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,10 @@
+2007-05-21 Christian Franke <franke@computer.org>
+ Corinna Vinschen <corinna@vinschen.de>
+
+ * fhandler_floppy.cc (fhandler_dev_floppy::lseek): Set buf size to
+ sector size. Simplify non-sector aligned case. Handle errors from
+ raw_read.
+
2007-05-15 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (adjust_socket_file_mode): New inline function.
diff --git a/winsup/cygwin/fhandler_floppy.cc b/winsup/cygwin/fhandler_floppy.cc
index c4ebcc0ff..ee8d56b57 100644
--- a/winsup/cygwin/fhandler_floppy.cc
+++ b/winsup/cygwin/fhandler_floppy.cc
@@ -408,10 +408,10 @@ fhandler_dev_floppy::raw_write (const void *ptr, size_t len)
_off64_t
fhandler_dev_floppy::lseek (_off64_t offset, int whence)
{
- char buf[512];
+ char buf[bytes_per_sector];
_off64_t lloffset = offset;
LARGE_INTEGER sector_aligned_offset;
- _off64_t bytes_left;
+ size_t bytes_left;
if (whence == SEEK_END)
{
@@ -453,9 +453,11 @@ fhandler_dev_floppy::lseek (_off64_t offset, int whence)
if (bytes_left)
{
- size_t len = bytes_left;
- raw_read (buf, len);
+ raw_read (buf, bytes_left);
+ if (bytes_left == (size_t) -1)
+ return -1;
}
+
return sector_aligned_offset.QuadPart + bytes_left;
}