From 6cac5c9eae80999047a1cc85c16557fd52d73fd6 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Fri, 25 Mar 2022 16:25:28 -0700 Subject: [PATCH] DISK: Force Read Only for all ISO container attach operations ISO files and real CDs exist which don't have ISO 9660 file structure. These do contain ODS2 file systems since they were produced before ISO 9660 was standardized and certainly before OS support for ISO 9660 was added. As such, any file named .iso or .ISO will always be attached read-only since CDs are never naturally writable devices. --- sim_disk.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sim_disk.c b/sim_disk.c index e26a68d4..946ea5eb 100644 --- a/sim_disk.c +++ b/sim_disk.c @@ -2290,8 +2290,18 @@ if (pseudo_filesystem_size != 0) { /* Dummy file system size mechanism? */ } for (i = 0; checks[i] != NULL; i++) - if ((ret_val = checks[i] (uptr, 0, readonly)) != (t_offset)-1) + if ((ret_val = checks[i] (uptr, 0, readonly)) != (t_offset)-1) { + /* ISO files that haven't already been determined to be ISO 9660 + * which contain a known file system are also marked read-only + * now. This fits early DEC distribution CDs that were created + * before ISO 9660 was standardized and operating support was added. + */ + if ((readonly != NULL) && + (*readonly == FALSE) && + (NULL != match_ext (uptr->filename, "ISO"))) + *readonly = TRUE; return ret_val; + } /* * The only known interleaved disk devices have either 256 byte * or 128 byte sector sizes. If additional interleaved file