diff --git a/src/DETHRACE/common/utility.c b/src/DETHRACE/common/utility.c index 2127d8d9..6d7156fb 100644 --- a/src/DETHRACE/common/utility.c +++ b/src/DETHRACE/common/utility.c @@ -627,12 +627,14 @@ FILE* OpenUniqueFileB(char* pPrefix, char* pExtension) { FILE* f; tPath_name the_path; + index = 0; for (index = 0; index < 10000; index++) { PathCat(the_path, gApplication_path, pPrefix); sprintf(the_path + strlen(the_path), "%04d.%s", index, pExtension); f = DRfopen(the_path, "rt"); if (f == NULL) { - return DRfopen(the_path, "wb"); + f = DRfopen(the_path, "wb"); + return f; } fclose(f); }