Fossil SCM

Fix the db_is_writable() routine to return FALSE if the database is not even open.

drh 2012-07-19 15:41 trunk
Commit 0c0f268ff3fd2b0b12d936ac0e3c9b7418e908af
1 file changed +1 -1
+1 -1
--- src/db.c
+++ src/db.c
@@ -1027,11 +1027,11 @@
10271027
10281028
/*
10291029
** Return true if the database is writeable
10301030
*/
10311031
int db_is_writeable(const char *zName){
1032
- return !sqlite3_db_readonly(g.db, db_name(zName));
1032
+ return g.db!=0 && !sqlite3_db_readonly(g.db, db_name(zName));
10331033
}
10341034
10351035
/*
10361036
** Verify that the repository schema is correct. If it is not correct,
10371037
** issue a fatal error and die.
10381038
--- src/db.c
+++ src/db.c
@@ -1027,11 +1027,11 @@
1027
1028 /*
1029 ** Return true if the database is writeable
1030 */
1031 int db_is_writeable(const char *zName){
1032 return !sqlite3_db_readonly(g.db, db_name(zName));
1033 }
1034
1035 /*
1036 ** Verify that the repository schema is correct. If it is not correct,
1037 ** issue a fatal error and die.
1038
--- src/db.c
+++ src/db.c
@@ -1027,11 +1027,11 @@
1027
1028 /*
1029 ** Return true if the database is writeable
1030 */
1031 int db_is_writeable(const char *zName){
1032 return g.db!=0 && !sqlite3_db_readonly(g.db, db_name(zName));
1033 }
1034
1035 /*
1036 ** Verify that the repository schema is correct. If it is not correct,
1037 ** issue a fatal error and die.
1038

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button