Ensure that curSchema is set before opening the DB

Without this, it's possible to get `curSchema = 0` which then causes us
not to trigger the branch that maintains forward compatibility with the
1.12 schema.

Fixes #1332
This commit is contained in:
Dan Peebles 2017-04-14 14:44:28 -04:00
parent eb6f3d5159
commit ad9e6037a4
1 changed files with 2 additions and 0 deletions

View File

@ -225,6 +225,7 @@ LocalStore::LocalStore(bool reserveSpace)
schemaPath = settings.nixDBPath + "/schema";
if (settings.readOnlyMode) {
curSchema = getSchema();
openDB(false);
return;
}
@ -309,6 +310,7 @@ LocalStore::LocalStore(bool reserveSpace)
} catch (SysError & e) {
if (e.errNo != EACCES) throw;
settings.readOnlyMode = true;
curSchema = getSchema();
openDB(false);
return;
}