From 790ad53feea5963347704f0b5edc724d9b175ab7 Mon Sep 17 00:00:00 2001 From: Kenneth J Davis Date: Sun, 10 Apr 2005 15:00:37 +0000 Subject: [PATCH] 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 --- kernel/fatfs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/fatfs.c b/kernel/fatfs.c index b53a4ff..71240b0 100644 --- a/kernel/fatfs.c +++ b/kernel/fatfs.c @@ -1973,8 +1973,11 @@ COUNT dos_setfattr(BYTE * name, UWORD attrp) 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)) + if ((attrp & D_DIR) && !(fnp->f_dir.dir_attrib & D_DIR)) + { + dos_close(fd); return DE_ACCESS; + } /* set attributes that user requested */ fnp->f_dir.dir_attrib |= attrp; /* JPP */