diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-10-16T12·51+0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-10-16T12·55+0200 |
commit | ff02f5336cd0cff0e97fbcf3c54b5b23827702d6 (patch) | |
tree | 63181f6bfbe252b22c629930d44a776616580527 /src/libstore/local-store.cc | |
parent | 4bd52825734face53df2ab00052d2457d31c3c68 (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/libstore/local-store.cc')
-rw-r--r-- | src/libstore/local-store.cc | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 15200e8421ae..9f324608c26b 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)); |