forked from Mirrors/wine-wine
winegcc: wait when temp file already exists
In some obscure cases a file get built twice (with equal environment and arguments) so that temp file exists in a parallel build. The solution to this is to wait some time (12 * 5sec), hoping that the other process is done and release the filename. Signed-off-by: Marko Semet <marko@marko10-000.de>feature/deterministic
parent
cb6fcfc2bb
commit
1b87584bf5
|
@ -428,7 +428,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)
|
||||
|
|
Loading…
Reference in New Issue