UI/updater: Use a unique temp path for patch files
Fixes a case where patches for the same destination file but different source files would clobber each other and cause integrity check failures.master
parent
09da3ac439
commit
854d75919f
|
@ -46,6 +46,8 @@ int totalFileSize = 0;
|
|||
int completedFileSize = 0;
|
||||
static int completedUpdates = 0;
|
||||
|
||||
static wchar_t tempPath[MAX_PATH];
|
||||
|
||||
struct LastError {
|
||||
DWORD code;
|
||||
inline LastError() { code = GetLastError(); }
|
||||
|
@ -879,6 +881,13 @@ static void UpdateWithPatchIfAvailable(const char *name, const char *hash,
|
|||
update.sourceURL = sourceURL;
|
||||
update.fileSize = size;
|
||||
update.patchable = true;
|
||||
|
||||
/* Since the patch depends on the previous version, we can
|
||||
* no longer rely on the temp name being unique to the
|
||||
* new file's hash */
|
||||
update.tempPath = tempPath;
|
||||
update.tempPath += L"\\";
|
||||
update.tempPath += patchHashStr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1065,8 +1074,6 @@ static bool UpdateFile(update_t &file)
|
|||
return true;
|
||||
}
|
||||
|
||||
static wchar_t tempPath[MAX_PATH] = {};
|
||||
|
||||
#define PATCH_MANIFEST_URL \
|
||||
L"https://obsproject.com/update_studio/getpatchmanifest"
|
||||
#define HASH_NULL L"0000000000000000000000000000000000000000"
|
||||
|
|
Loading…
Reference in New Issue