SCP: Assure that files attached honor the unit Read-Only flag in addition to -R switches.
This commit is contained in:
parent
622c594e59
commit
5a99bcf185
2 changed files with 8 additions and 4 deletions
6
scp.c
6
scp.c
|
@ -5183,8 +5183,10 @@ uptr->filename = (char *) calloc (CBUFSIZE, sizeof (char)); /* alloc name buf */
|
|||
if (uptr->filename == NULL)
|
||||
return SCPE_MEM;
|
||||
strncpy (uptr->filename, cptr, CBUFSIZE); /* save name */
|
||||
if (sim_switches & SWMASK ('R')) { /* read only? */
|
||||
if ((uptr->flags & UNIT_ROABLE) == 0) /* allowed? */
|
||||
if ((sim_switches & SWMASK ('R')) || /* read only? */
|
||||
((uptr->flags & UNIT_RO) != 0)) {
|
||||
if (((uptr->flags & UNIT_ROABLE) == 0) && /* allowed? */
|
||||
((uptr->flags & UNIT_RO) == 0))
|
||||
return attach_err (uptr, SCPE_NORO); /* no, error */
|
||||
uptr->fileref = sim_fopen (cptr, "rb"); /* open rd only */
|
||||
if (uptr->fileref == NULL) /* open fail? */
|
||||
|
|
|
@ -1076,8 +1076,10 @@ ctx->dbit = dbit; /* save debug bit */
|
|||
sim_debug (ctx->dbit, ctx->dptr, "sim_disk_attach(unit=%d,filename='%s')\n", (int)(uptr-ctx->dptr->units), uptr->filename);
|
||||
ctx->auto_format = auto_format; /* save that we auto selected format */
|
||||
ctx->storage_sector_size = (uint32)sector_size; /* Default */
|
||||
if (sim_switches & SWMASK ('R')) { /* read only? */
|
||||
if ((uptr->flags & UNIT_ROABLE) == 0) /* allowed? */
|
||||
if ((sim_switches & SWMASK ('R')) || /* read only? */
|
||||
((uptr->flags & UNIT_RO) != 0)) {
|
||||
if (((uptr->flags & UNIT_ROABLE) == 0) && /* allowed? */
|
||||
((uptr->flags & UNIT_RO) == 0))
|
||||
return _err_return (uptr, SCPE_NORO); /* no, error */
|
||||
uptr->fileref = open_function (cptr, "rb"); /* open rd only */
|
||||
if (uptr->fileref == NULL) /* open fail? */
|
||||
|
|
Loading…
Add table
Reference in a new issue