From 4dcdd071e594be6d9b3b75f383fb472f9b906439 Mon Sep 17 00:00:00 2001 From: Kenneth J Davis Date: Tue, 5 Apr 2005 15:08:30 +0000 Subject: [PATCH] bug 1874 fix, do not consider setting DIR bit an error for int 21/4301=set attribute, if really is a directory git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1123 6ac86273-5f31-0410-b378-82cca8765d1b --- kernel/fatfs.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/kernel/fatfs.c b/kernel/fatfs.c index 1012bae..b53a4ff 100644 --- a/kernel/fatfs.c +++ b/kernel/fatfs.c @@ -1953,8 +1953,13 @@ COUNT dos_setfattr(BYTE * name, UWORD attrp) COUNT fd; f_node_ptr fnp; - /* JPP-If user tries to set VOLID or DIR bits, return error */ - if ((attrp & (D_VOLID | D_DIR | 0xC0)) != 0) + /* JPP-If user tries to set VOLID or RESERVED bits, return error. + We used to also check for D_DIR here, but causes issues with deltree + which is trying to work around another issue. So now we check + these here, and only report DE_ACCESS if user tries to set directory + bit on a non-directory entry. + */ + if ((attrp & (D_VOLID | 0xC0)) != 0) return DE_ACCESS; fd = (short)dos_open(name, O_RDONLY | O_OPEN, 0); @@ -1966,6 +1971,10 @@ COUNT dos_setfattr(BYTE * name, UWORD attrp) /* Set the attribute from the fnode and return */ /* clear all attributes but DIR and VOLID */ fnp->f_dir.dir_attrib &= (D_VOLID | D_DIR); /* JPP */ + + /* if caller tries to set DIR on non-directory, return error */ + if (!(fnp->f_dir.dir_attrib & D_DIR) && (attrp & D_DIR)) + return DE_ACCESS; /* set attributes that user requested */ fnp->f_dir.dir_attrib |= attrp; /* JPP */