From 4e21e947fc81997d8860eabcb245e8d75c3bb039 Mon Sep 17 00:00:00 2001 From: Andrew Bird Date: Thu, 7 Jan 2021 21:00:12 +0000 Subject: [PATCH] FATFS: rmdir of read only directories is valid After comparison with DR-DOS 7.01 and MS-DOS 6.22 over at Dosemu2 it was seen that rmdir of a directory having the _A_RDONLY bit set should succeed. This patch makes that change. For reference the test report can be found in the fdpp issue https://github.com/dosemu2/fdpp/issues/161. An identical patch has been applied there. --- kernel/fatfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/fatfs.c b/kernel/fatfs.c index eaaab2b..eb9b97d 100644 --- a/kernel/fatfs.c +++ b/kernel/fatfs.c @@ -463,8 +463,9 @@ COUNT dos_rmdir(BYTE * path) return DE_PATHNOTFND; /* Directories may have attributes, but if other than 'archive' */ - /* then do not allow (RDONLY|SYSTEM|HIDDEN) directory to be deleted. */ - if (fnp->f_dir.dir_attrib & ~(D_DIR |D_ARCHIVE)) + /* or 'read only' then deny i.e. do not allow (SYSTEM|HIDDEN) */ + /* directory to be deleted. */ + if (fnp->f_dir.dir_attrib & ~(D_DIR | D_RDONLY | D_ARCHIVE)) return DE_ACCESS; dir_read(fnp);