From 070c77ec7996cd46f57cb43f1a1e8a207522da51 Mon Sep 17 00:00:00 2001 From: Timothe Litt Date: Sun, 9 Apr 2023 11:34:24 -0400 Subject: [PATCH] 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 --- extracters/ods2/rms.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/extracters/ods2/rms.c b/extracters/ods2/rms.c index bcba689..0ab24e6 100644 --- a/extracters/ods2/rms.c +++ b/extracters/ods2/rms.c @@ -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 )