Mail Archives: cygwin-developers/1998/11/06/03:58:55
The behaviour of fhandler_base::open is incorrect for access to
raw tape and disk devices. The access to tapes must allow
GENERIC_WRITE, if you want to control (e.g. ioctl calls) the
tape device. In this case, the Windows access mode is not
equivalent to the mode given as parameter, which can still be
O_RDONLY.
Regards,
Corinna
ChangeLog:
----------
Tue Nov 03 00:08:33 1998 Corinna Vinschen <corinna DOT vinschen AT cityweb DOT de>
* fhandler.cc (fhandler_base::open): Changed access and
behaviour of append mode in case of raw tape or disk device.
---- snip ----
--- fhandler.cc.orig Tue Nov 03 00:08:33 1998
+++ fhandler.cc Tue Nov 03 00:14:17 1998
@@ -220,7 +220,12 @@ fhandler_base::open (int flags, mode_t m
goto done;
}
- if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_RDONLY)
+ if (get_device () == FH_TAPE
+ || get_device () == FH_FLOPPY)
+ {
+ access_ = GENERIC_READ | GENERIC_WRITE;
+ }
+ else if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_RDONLY)
{
access_ = GENERIC_READ;
}
@@ -325,10 +330,14 @@ fhandler_base::open (int flags, mode_t m
syscall_printf ("filemode defaulting to text");
}
- if (flags & O_APPEND)
- SetFilePointer (get_handle(), 0, 0, FILE_END);
- else
- SetFilePointer (get_handle(), 0, 0, FILE_BEGIN);
+ if (get_device () != FH_TAPE
+ && get_device () != FH_FLOPPY)
+ {
+ if (flags & O_APPEND)
+ SetFilePointer (get_handle(), 0, 0, FILE_END);
+ else
+ SetFilePointer (get_handle(), 0, 0, FILE_BEGIN);
+ }
res = 1;
done:
- Raw text -