Skip to content

Commit 4e21e94

Browse files
andrewbirdPerditionC
authored andcommitted
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 dosemu2/fdpp#161. An identical patch has been applied there.
1 parent 92ae538 commit 4e21e94

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

kernel/fatfs.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,9 @@ COUNT dos_rmdir(BYTE * path)
463463
return DE_PATHNOTFND;
464464

465465
/* Directories may have attributes, but if other than 'archive' */
466-
/* then do not allow (RDONLY|SYSTEM|HIDDEN) directory to be deleted. */
467-
if (fnp->f_dir.dir_attrib & ~(D_DIR |D_ARCHIVE))
466+
/* or 'read only' then deny i.e. do not allow (SYSTEM|HIDDEN) */
467+
/* directory to be deleted. */
468+
if (fnp->f_dir.dir_attrib & ~(D_DIR | D_RDONLY | D_ARCHIVE))
468469
return DE_ACCESS;
469470

470471
dir_read(fnp);

0 commit comments

Comments
 (0)