changeset 2:2f2cbd2d2561

Theoretically make "C" flag for drive defs work.
author William Astle <lost@l-w.ca>
date Sun, 29 May 2016 10:44:29 -0600
parents cfc9524cca2c
children e94940ca17e7
files src/lwwire.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lwwire.c	Sun May 08 13:45:40 2016 -0600
+++ b/src/lwwire.c	Sun May 29 10:44:29 2016 -0600
@@ -73,6 +73,7 @@
 int lwwire_fetch_sector(int dn, int lsn, void *);
 int lwwire_save_sector(int dn, int lsn, void *);
 int nonblock(int);
+int lwwire_drive_readononly(int dn);
 
 void lwwire_proto_read(void);
 void lwwire_proto_write(void);
@@ -622,6 +623,12 @@
 	return drivedata[dn].fp;
 }
 
+int lwwire_drive_readonly(int dn)
+{
+	return drivedata[dn].isconst;
+}
+
+
 /* read a sector from a disk image */
 int lwwire_fetch_sector(int dn, int lsn, void *buf)
 {
@@ -647,6 +654,8 @@
 	FILE *fp;
 	int rc;
 
+	if (lwwire_drive_readonly(dn))
+		return LWERR_WRITE;
 	fp = lwwire_fetch_drive_fp(dn);
 	if (!fp)
 		return LWERR_NOTREADY;