don't leave fd open when failing DIR bit check

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1124 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Kenneth J Davis 2005-04-10 15:00:37 +00:00
parent 4dcdd071e5
commit 790ad53fee

View File

@ -1973,8 +1973,11 @@ COUNT dos_setfattr(BYTE * name, UWORD attrp)
fnp->f_dir.dir_attrib &= (D_VOLID | D_DIR); /* JPP */ fnp->f_dir.dir_attrib &= (D_VOLID | D_DIR); /* JPP */
/* if caller tries to set DIR on non-directory, return error */ /* if caller tries to set DIR on non-directory, return error */
if (!(fnp->f_dir.dir_attrib & D_DIR) && (attrp & D_DIR)) if ((attrp & D_DIR) && !(fnp->f_dir.dir_attrib & D_DIR))
{
dos_close(fd);
return DE_ACCESS; return DE_ACCESS;
}
/* set attributes that user requested */ /* set attributes that user requested */
fnp->f_dir.dir_attrib |= attrp; /* JPP */ fnp->f_dir.dir_attrib |= attrp; /* JPP */