aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-10-16 14:51:20 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-10-16 14:55:53 +0200
commitff02f5336cd0cff0e97fbcf3c54b5b23827702d6 (patch)
tree63181f6bfbe252b22c629930d44a776616580527 /src
parent4bd52825734face53df2ab00052d2457d31c3c68 (diff)
Fix a race in registerFailedPath()
Registering the path as failed can fail if another process does the same thing after the call to hasPathFailed(). This is extremely unlikely though.
Diffstat (limited to 'src')
-rw-r--r--src/libstore/local-store.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 15200e842..9f324608c 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -421,7 +421,7 @@ void LocalStore::openDB(bool create)
stmtInvalidatePath.create(db,
"delete from ValidPaths where path = ?;");
stmtRegisterFailedPath.create(db,
- "insert into FailedPaths (path, time) values (?, ?);");
+ "insert or ignore into FailedPaths (path, time) values (?, ?);");
stmtHasPathFailed.create(db,
"select time from FailedPaths where path = ?;");
stmtQueryFailedPaths.create(db,
@@ -692,7 +692,6 @@ void LocalStore::addReference(unsigned long long referrer, unsigned long long re
void LocalStore::registerFailedPath(const Path & path)
{
- if (hasPathFailed(path)) return;
SQLiteStmtUse use(stmtRegisterFailedPath);
stmtRegisterFailedPath.bind(path);
stmtRegisterFailedPath.bind(time(0));