From 482d2ab34927aefb0f15fec5fa730e748e1015fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Strohh=C3=A4cker?= Date: Mon, 18 Feb 2008 17:45:55 +0000 Subject: [PATCH] correct error code when dos create file is called with directory bit set (fixes some pkunzip oddity) Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3103 --- src/dos/dos_files.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/dos/dos_files.cpp b/src/dos/dos_files.cpp index 6c921731..dfef87f0 100644 --- a/src/dos/dos_files.cpp +++ b/src/dos/dos_files.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_files.cpp,v 1.94 2008-01-21 21:26:49 qbix79 Exp $ */ +/* $Id: dos_files.cpp,v 1.95 2008-02-18 17:45:55 c2woody Exp $ */ #include #include @@ -426,6 +426,11 @@ bool DOS_CreateFile(char const * name,Bit16u attributes,Bit16u * entry) { DOS_SetError(DOSERR_TOO_MANY_OPEN_FILES); return false; } + /* Don't allow directories to be created */ + if (attributes&0x10) { + DOS_SetError(DOSERR_ACCESS_DENIED); + return false; + } bool foundit=Drives[drive]->FileCreate(&Files[handle],fullname,attributes); if (foundit) { Files[handle]->SetDrive(drive);