Skip to content
Snippets Groups Projects
Commit d371828c authored by Lukas Braun's avatar Lukas Braun
Browse files

fix transaction_failed

- sqlite3.ErrNo is not an sqlite3.Error, we have to unpack it first
- an interrupted transaction in an in-memory database (with shared
  cache) leads to ErrLocked, while in a regular file-backed databes an
  ErrBusy is returned
parent 05b699e7
No related branches found
No related tags found
No related merge requests found
......@@ -164,8 +164,10 @@ func get_otp(tx *sql.Tx, name string) (*hotp.HOTP, error) {
}
func transaction_failed(err error) bool {
// XXX: check type first?
return err == sqlite3.ErrBusy
if err, ok := err.(sqlite3.Error); ok {
return err.Code == sqlite3.ErrLocked || err.Code == sqlite3.ErrBusy
}
return false
}
// Retrieve secret and count for given username and try to find a match within
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment