about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-02-24T16·44+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-02-24T16·44+0000
commitaf565c348a286fb55ad17f8c3c4233465d32a9f6 (patch)
treea7f19c633efc41009d31487542f658a6e1794747
parente33f67ff0b02cc8fc2e0024dd87a6d61467df177 (diff)
* Support read-only access to the database.
-rw-r--r--src/libstore/local-store.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 7e205a9bf2d8..95e775ce798f 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -173,7 +173,10 @@ LocalStore::LocalStore()
     
     schemaPath = nixDBPath + "/schema";
     
-    if (readOnlyMode) return;
+    if (readOnlyMode) {
+        openDB(false);
+        return;
+    }
 
     /* Create missing state directories if they don't already exist. */
     createDirs(nixStore);
@@ -197,6 +200,7 @@ LocalStore::LocalStore()
     } catch (SysError & e) {
         if (e.errNo != EACCES) throw;
         readOnlyMode = true;
+        openDB(false);
         return;
     }