aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/fhandler_raw.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2001-02-05 16:10:06 +0000
committerCorinna Vinschen <corinna@vinschen.de>2001-02-05 16:10:06 +0000
commitae9b22c69b7374129d872cde66290c925a0c9857 (patch)
treecca1713686b18ff588f7c3a7f8ef8409aea86aeb /winsup/cygwin/fhandler_raw.cc
parentcada03f92f6d9f2126ab8dd094a740bdeb673103 (diff)
downloadnewlib-ae9b22c69b7374129d872cde66290c925a0c9857.zip
newlib-ae9b22c69b7374129d872cde66290c925a0c9857.tar.gz
newlib-ae9b22c69b7374129d872cde66290c925a0c9857.tar.bz2
* fhandler.cc (fhandler_base::open): Always add GENERIC_READ access
when opening raw disk devices. * fhandler_floppy.cc (fhandler_dev_floppy::lseek): Implement bytewise access. * fhandler_raw.cc (fhandler_dev_raw::open): Always open raw disk device binary. (fhandler_dev_raw::raw_write): Don't drop read buffer content when writing after read.
Diffstat (limited to 'winsup/cygwin/fhandler_raw.cc')
-rw-r--r--winsup/cygwin/fhandler_raw.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/winsup/cygwin/fhandler_raw.cc b/winsup/cygwin/fhandler_raw.cc
index 70cf828..d8ecf61 100644
--- a/winsup/cygwin/fhandler_raw.cc
+++ b/winsup/cygwin/fhandler_raw.cc
@@ -135,8 +135,10 @@ fhandler_dev_raw::open (const char *path, int flags, mode_t)
set_name (path, real_path.get_win32 ());
- /* Always open a raw device existing */
- ret = fhandler_base::open (path, flags & ~(O_CREAT | O_TRUNC));
+ /* Always open a raw device existing and binary. */
+ flags &= ~(O_CREAT | O_TRUNC);
+ flags |= O_BINARY;
+ ret = fhandler_base::open (path, flags);
if (ret)
{
if (devbufsiz > 1L)
@@ -334,7 +336,10 @@ fhandler_dev_raw::raw_write (const void *ptr, size_t len)
}
if (!is_writing)
- devbufstart = devbufend = 0;
+ {
+ devbufend = devbufstart;
+ devbufstart = 0;
+ }
is_writing = 1;
if (devbuf)