Fossil SCM
Fix the db_is_writable() routine to return FALSE if the database is not even open.
Commit
0c0f268ff3fd2b0b12d936ac0e3c9b7418e908af
Parent
7ee938f40e9164c…
1 file changed
+1
-1
M
src/db.c
+1
-1
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -1027,11 +1027,11 @@ | ||
| 1027 | 1027 | |
| 1028 | 1028 | /* |
| 1029 | 1029 | ** Return true if the database is writeable |
| 1030 | 1030 | */ |
| 1031 | 1031 | 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)); | |
| 1033 | 1033 | } |
| 1034 | 1034 | |
| 1035 | 1035 | /* |
| 1036 | 1036 | ** Verify that the repository schema is correct. If it is not correct, |
| 1037 | 1037 | ** issue a fatal error and die. |
| 1038 | 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 !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 |