Fix atomically writing to a file
For the trick to work, the file needs to be on the same filesystem. The tempdir is likely not on the same filesystem so the rename will not be instantaneous. This probably worked in the past when the tempdir was expected to be a subdir of the SimpleSAMLphp installation. Fix it by writing a file to the same directory as the target file, which will always be on the same FS. Also do not just use a rand() number but something more random as we do in other places in the code.
Please register or sign in to comment