forked from lix-project/lix
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.
This commit is contained in:
parent
4bd5282573
commit
ff02f5336c
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue