* Support read-only access to the database.
This commit is contained in:
		
							parent
							
								
									e33f67ff0b
								
							
						
					
					
						commit
						af565c348a
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -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;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue