winebuild: wait when temp file already exists

In case temp file already exists it will wait (12 * 5sec) to generate
the temp file hoping that the other one is gone. This fix parallel
builds with two parallel calls with equal environment and arguments.

Signed-off-by: Marko Semet <marko@marko10-000.de>
feature/deterministic
Marko Semet 2020-06-21 04:02:02 +02:00
parent 6c5b40382b
commit 9715f3e73d
1 changed files with 13 additions and 1 deletions

View File

@ -1319,7 +1319,19 @@ int pseudorandom_tempfile(char* file)
}
/* try to open file */
return open(file, O_CREAT | O_EXCL | O_RDWR, 0600);
int result;
int counter = 0;
do
{
result = open(file, O_CREAT | O_EXCL | O_RDWR, 0600);
if (result != -1)
{
break;
}
sleep(5);
counter++;
} while (counter <= 12);
return result;
}
void init_random_generator(int argc, char **argv)