ODS2: Create/Directory fails (#9)

Create/directory fails because ODS-2 directories use
VAR records with a MRS of 512 and RAT of NOSPAN.

Ordinarily, MRS of 512 limits the data in a VAR record
to 510 bytes (2 bytes are used for the record length).

In the case of a directory, MRS includes the record length.

ODS2 enforces the MRS, but did not take this case into
account.

Fixes #8
This commit is contained in:
Timothe Litt
2023-04-09 11:34:24 -04:00
committed by GitHub
parent b4c0ad7684
commit 070c77ec79

View File

@@ -2737,6 +2737,15 @@ vmscond_t sys_create( struct FAB *fab ) {
sts = RMS$_FSZ;
break;
case FAB$C_VAR:
/* Directories use MRS of 512 but are also NOSPAN */
if (i >= sizeof("A.DIR;1") - 1 &&
!strcmp(fn + i - (sizeof(".DIR;1") - 1), ".DIR;1")) {
if (fab->fab$w_mrs != 512 || !(fab->fab$b_rat & FAB$M_BLK)) {
sts = RMS$_RSZ;
break;
}
break;
}
if( fab->fab$w_mrs > ((fab->fab$b_rat & FAB$M_BLK)? 510: 32767) )
sts = RMS$_RSZ;
else if( fab->fab$b_fsz )