mirror of
https://github.com/NixOS/nix
synced 2025-06-27 08:31:16 +02:00
Use rand
not random
for creating GC root indirect links
I don't think fewer bits matters for this, and `rand` but not `random` is available on Windows.
This commit is contained in:
parent
538eb2617a
commit
3a3c205fa7
2 changed files with 3 additions and 2 deletions
|
@ -173,12 +173,13 @@ void initNix()
|
||||||
everybody. */
|
everybody. */
|
||||||
umask(0022);
|
umask(0022);
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
/* Initialise the PRNG. */
|
/* Initialise the PRNG. */
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
gettimeofday(&tv, 0);
|
gettimeofday(&tv, 0);
|
||||||
|
#ifndef _WIN32
|
||||||
srandom(tv.tv_usec);
|
srandom(tv.tv_usec);
|
||||||
#endif
|
#endif
|
||||||
|
srand(tv.tv_usec);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ static void makeSymlink(const Path & link, const Path & target)
|
||||||
createDirs(dirOf(link));
|
createDirs(dirOf(link));
|
||||||
|
|
||||||
/* Create the new symlink. */
|
/* Create the new symlink. */
|
||||||
Path tempLink = fmt("%1%.tmp-%2%-%3%", link, getpid(), random());
|
Path tempLink = fmt("%1%.tmp-%2%-%3%", link, getpid(), rand());
|
||||||
createSymlink(target, tempLink);
|
createSymlink(target, tempLink);
|
||||||
|
|
||||||
/* Atomically replace the old one. */
|
/* Atomically replace the old one. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue