summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_raw.cc
diff options
context:
space:
mode:
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 70cf8284c..d8ecf61ea 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)