[CABINET]

- Really use random temporary file name

svn path=/trunk/; revision=56048
This commit is contained in:
Jérôme Gardou 2012-03-05 19:18:19 +00:00
parent 18a6ac6ae4
commit 4a78d2e988

View file

@ -115,7 +115,7 @@ CCFDATAStorage::~CCFDATAStorage()
}
ULONG CCFDATAStorage::Create(const char* FileName)
ULONG CCFDATAStorage::Create()
/*
* FUNCTION: Creates the file
* ARGUMENTS:
@ -124,13 +124,16 @@ ULONG CCFDATAStorage::Create(const char* FileName)
* Status of operation
*/
{
#if defined(_WIN32)
char tmpPath[MAX_PATH];
#endif
ASSERT(!FileCreated);
#if defined(_WIN32)
if (GetTempPath(MAX_PATH, FullName) == 0)
if (GetTempPath(MAX_PATH, tmpPath) == 0)
return CAB_STATUS_CANNOT_CREATE;
if(GetTempFileName(tmpPath, "cab", 0, FullName) == 0)
return CAB_STATUS_CANNOT_CREATE;
strcat(FullName, FileName);
/* Create file, overwrite if it already exists */
FileHandle = CreateFile(FullName, // Create this file
@ -1529,7 +1532,7 @@ ULONG CCabinet::NewCabinet()
return CAB_STATUS_NOMEMORY;
}
Status = ScratchFile->Create("~CAB.tmp");
Status = ScratchFile->Create();
CreateNewFolder = false;