diff options
author | Javier <dev.git@javispedro.com> | 2022-04-27 01:08:09 +0200 |
---|---|---|
committer | Javier <dev.git@javispedro.com> | 2022-04-27 01:08:09 +0200 |
commit | 13cc0921d8f9a0d488a27e2c86c1d9d013a964fe (patch) | |
tree | 7141ab5cc141044a1cbfe2055ac92b21aa41898c /sftsr.c | |
parent | 2aa8f27619b098baa7b8231255521c8d6c27c1db (diff) | |
download | vbados-13cc0921d8f9a0d488a27e2c86c1d9d013a964fe.tar.gz vbados-13cc0921d8f9a0d488a27e2c86c1d9d013a964fe.zip |
fix leaking SFTs on close
Diffstat (limited to 'sftsr.c')
-rw-r--r-- | sftsr.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -43,6 +43,8 @@ static uint8_t map_shfl_attr_to_dosattr(const SHFLFSOBJATTR *a) { // DOS attributes are in the higher word of fMode (see RTFS_DOS_*) uint8_t attr = (a->fMode >> 16) & 0x3F; + // Albeit also map the UNIX S_IFDIR attrib to DOS SUBDIR one, + // since at least on Linux hosts the DOS one may not be set if (a->fMode & 0x4000U) attr |= _A_SUBDIR; return attr; } @@ -487,6 +489,11 @@ static void handle_close(union INTPACK __far *r) } dos_sft_decref(sft); + if (sft->num_handles == 0xFFFF) { + // SFT is no longer referenced, clear it up + set_sft_openfile_index(sft, 0); + sft->num_handles = 0; + } data.files[openfile].root = SHFL_ROOT_NIL; data.files[openfile].handle = SHFL_HANDLE_NIL; |