From 88d134b3a9d466b7381e9f019aceec620fefd487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Strohh=C3=A4cker?= Date: Sat, 14 Mar 2009 16:10:00 +0000 Subject: [PATCH] implement temp file creation function when used without a path (see sf bug #2665465) Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3317 --- src/dos/dos.cpp | 8 ++++---- src/dos/dos_files.cpp | 12 +++++++----- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/dos/dos.cpp b/src/dos/dos.cpp index e9ae9c3b..cd3ff0eb 100644 --- a/src/dos/dos.cpp +++ b/src/dos/dos.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2008 The DOSBox Team + * Copyright (C) 2002-2009 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.cpp,v 1.115 2009-01-14 22:16:00 qbix79 Exp $ */ +/* $Id: dos.cpp,v 1.116 2009-03-14 16:10:00 c2woody Exp $ */ #include #include @@ -67,8 +67,8 @@ static Bitu DOS_21Handler(void) { psp.SetStack(RealMake(SegValue(ss),reg_sp-18)); } - char name1[DOSNAMEBUF+1]; - char name2[DOSNAMEBUF+1]; + char name1[DOSNAMEBUF+2+DOS_NAMELENGTH_ASCII]; + char name2[DOSNAMEBUF+2+DOS_NAMELENGTH_ASCII]; switch (reg_ah) { case 0x01: /* Read character from STDIN, with echo */ { diff --git a/src/dos/dos_files.cpp b/src/dos/dos_files.cpp index 0f4da6a3..4d80ab59 100644 --- a/src/dos/dos_files.cpp +++ b/src/dos/dos_files.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_files.cpp,v 1.105 2009-01-24 16:22:55 c2woody Exp $ */ +/* $Id: dos_files.cpp,v 1.106 2009-03-14 16:10:00 c2woody Exp $ */ #include #include @@ -698,19 +698,21 @@ bool DOS_ForceDuplicateEntry(Bit16u entry,Bit16u newentry) { } - bool DOS_CreateTempFile(char * const name,Bit16u * entry) { - /* First add random crap to the end of the name and try to open */ size_t namelen=strlen(name); char * tempname=name+namelen; - if (namelen==0) E_Exit("DOS:Invalid call to CreateTempFile"); - else { + if (namelen==0) { + // temp file created in root directory + tempname[0]='\\'; + tempname++; + } else { if ((name[namelen-1]!='\\') && (name[namelen-1]!='/')) { tempname[0]='\\'; tempname++; } } dos.errorcode=0; + /* add random crap to the end of the name and try to open */ do { Bit32u i; for (i=0;i<8;i++) {