* Support read-only access to the database.

This commit is contained in:
Eelco Dolstra 2010-02-24 16:44:43 +00:00
parent e33f67ff0b
commit af565c348a

View file

@ -173,7 +173,10 @@ LocalStore::LocalStore()
schemaPath = nixDBPath + "/schema"; schemaPath = nixDBPath + "/schema";
if (readOnlyMode) return; if (readOnlyMode) {
openDB(false);
return;
}
/* Create missing state directories if they don't already exist. */ /* Create missing state directories if they don't already exist. */
createDirs(nixStore); createDirs(nixStore);
@ -197,6 +200,7 @@ LocalStore::LocalStore()
} catch (SysError & e) { } catch (SysError & e) {
if (e.errNo != EACCES) throw; if (e.errNo != EACCES) throw;
readOnlyMode = true; readOnlyMode = true;
openDB(false);
return; return;
} }