aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2022-04-30 17:00:18 +0200
committerJavier <dev.git@javispedro.com>2022-04-30 17:00:18 +0200
commitda8b5a53bb615fb8020dd294ebdbaa6bb776fad6 (patch)
tree461f1974fddadbe65644f970b4d5609dc0c0ac59
parentbe53f0370c78cf91e7b335a86e19c82e1416ad3b (diff)
downloadvbados-da8b5a53bb615fb8020dd294ebdbaa6bb776fad6.tar.gz
vbados-da8b5a53bb615fb8020dd294ebdbaa6bb776fad6.zip
another hack to avoid leaking dirfd on 'dir *.*'
-rw-r--r--sftsr.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sftsr.c b/sftsr.c
index ffbf326..fb41431 100644
--- a/sftsr.c
+++ b/sftsr.c
@@ -1172,6 +1172,14 @@ static void handle_find_first(union INTPACK __far *r)
dlog_puts("search volid OK");
clear_dos_err(r);
return;
+ } else if (search_attr == 0) {
+ // Another hack to avoid leaking directory handles.
+ // While technically a mask of 0 should return all files,
+ // DOS's dir uses a mask of 0 when it just wants to check
+ // if the directory exists, and will never call FindNext.
+ // So we'll not bother opening the directory and hope nothing breaks.
+ set_dos_err(r, DOS_ERROR_NO_MORE_FILES);
+ return;
}
// First, open the desired directory for searching