forked from lix-project/lix
rand() -> random(), since we use srandom().
rand() requires we call srand() instead, but might as well use random().
This commit is contained in:
parent
70dbac7491
commit
56253bb08f
|
@ -1458,7 +1458,7 @@ void replaceValidPath(const Path & storePath, const Path tmpPath)
|
||||||
tmpPath (the replacement), so we have to move it out of the
|
tmpPath (the replacement), so we have to move it out of the
|
||||||
way first. We'd better not be interrupted here, because if
|
way first. We'd better not be interrupted here, because if
|
||||||
we're repairing (say) Glibc, we end up with a broken system. */
|
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))
|
if (pathExists(storePath))
|
||||||
rename(storePath.c_str(), oldPath.c_str());
|
rename(storePath.c_str(), oldPath.c_str());
|
||||||
if (rename(tmpPath.c_str(), storePath.c_str()) == -1)
|
if (rename(tmpPath.c_str(), storePath.c_str()) == -1)
|
||||||
|
|
|
@ -59,7 +59,7 @@ static void makeSymlink(const Path & link, const Path & target)
|
||||||
|
|
||||||
/* Create the new symlink. */
|
/* Create the new symlink. */
|
||||||
Path tempLink = (format("%1%.tmp-%2%-%3%")
|
Path tempLink = (format("%1%.tmp-%2%-%3%")
|
||||||
% link % getpid() % rand()).str();
|
% link % getpid() % random()).str();
|
||||||
createSymlink(target, tempLink);
|
createSymlink(target, tempLink);
|
||||||
|
|
||||||
/* Atomically replace the old one. */
|
/* Atomically replace the old one. */
|
||||||
|
|
|
@ -213,7 +213,7 @@ void LocalStore::optimisePath_(Activity * act, OptimiseStats & stats,
|
||||||
MakeReadOnly makeReadOnly(mustToggle ? dirOf(path) : "");
|
MakeReadOnly makeReadOnly(mustToggle ? dirOf(path) : "");
|
||||||
|
|
||||||
Path tempLink = (format("%1%/.tmp-link-%2%-%3%")
|
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 (link(linkPath.c_str(), tempLink.c_str()) == -1) {
|
||||||
if (errno == EMLINK) {
|
if (errno == EMLINK) {
|
||||||
|
|
Loading…
Reference in a new issue