aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWill Dietz <w@wdtz.org>2018-03-06 17:34:44 -0600
committerWill Dietz <w@wdtz.org>2018-03-06 17:44:25 -0600
commit56253bb08fef60f4768ebb2ca013135b0dbf5df3 (patch)
tree1c30b2e3a882c86c871ff6bcfd6d2d1f4493b608 /src
parent70dbac7491c372b514b4fd825f99a761803f40f5 (diff)
rand() -> random(), since we use srandom().
rand() requires we call srand() instead, but might as well use random().
Diffstat (limited to 'src')
-rw-r--r--src/libstore/build.cc2
-rw-r--r--src/libstore/gc.cc2
-rw-r--r--src/libstore/optimise-store.cc2
3 files changed, 3 insertions, 3 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 1d611ffba..47a905c81 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -1458,7 +1458,7 @@ void replaceValidPath(const Path & storePath, const Path tmpPath)
tmpPath (the replacement), so we have to move it out of the
way first. We'd better not be interrupted here, because if
we're repairing (say) Glibc, we end up with a broken system. */
- Path oldPath = (format("%1%.old-%2%-%3%") % storePath % getpid() % rand()).str();
+ Path oldPath = (format("%1%.old-%2%-%3%") % storePath % getpid() % random()).str();
if (pathExists(storePath))
rename(storePath.c_str(), oldPath.c_str());
if (rename(tmpPath.c_str(), storePath.c_str()) == -1)
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
index 943b16c28..ba49749d8 100644
--- a/src/libstore/gc.cc
+++ b/src/libstore/gc.cc
@@ -59,7 +59,7 @@ static void makeSymlink(const Path & link, const Path & target)
/* Create the new symlink. */
Path tempLink = (format("%1%.tmp-%2%-%3%")
- % link % getpid() % rand()).str();
+ % link % getpid() % random()).str();
createSymlink(target, tempLink);
/* Atomically replace the old one. */
diff --git a/src/libstore/optimise-store.cc b/src/libstore/optimise-store.cc
index 891540ae4..7840167d7 100644
--- a/src/libstore/optimise-store.cc
+++ b/src/libstore/optimise-store.cc
@@ -213,7 +213,7 @@ void LocalStore::optimisePath_(Activity * act, OptimiseStats & stats,
MakeReadOnly makeReadOnly(mustToggle ? dirOf(path) : "");
Path tempLink = (format("%1%/.tmp-link-%2%-%3%")
- % realStoreDir % getpid() % rand()).str();
+ % realStoreDir % getpid() % random()).str();
if (link(linkPath.c_str(), tempLink.c_str()) == -1) {
if (errno == EMLINK) {