diff options
author | stephan <stephan@noemail.net> | 2024-07-12 14:41:16 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2024-07-12 14:41:16 +0000 |
commit | 2e32cbc4a589fb80a0423e4d7917eb7e56db3ca7 (patch) | |
tree | 8bd5bafbc5b89e80bcbc17bf55c968326bcc685b /tool/sqldiff.c | |
parent | be3778dee23d0df84d4c721ddd85f1c8975b67ac (diff) | |
download | sqlite-2e32cbc4a589fb80a0423e4d7917eb7e56db3ca7.tar.gz sqlite-2e32cbc4a589fb80a0423e4d7917eb7e56db3ca7.zip |
sqldiff: fail if the 2nd db argument cannot be opened read-only.
FossilOrigin-Name: e8b33525fc2b4d609a7be9acc43fbc66638effaa7b092b48568ded6c53c4f4db
Diffstat (limited to 'tool/sqldiff.c')
-rw-r--r-- | tool/sqldiff.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tool/sqldiff.c b/tool/sqldiff.c index 96d3b6eab..8b2293caf 100644 --- a/tool/sqldiff.c +++ b/tool/sqldiff.c @@ -2006,6 +2006,13 @@ int main(int argc, char **argv){ if( rc || zErrMsg ){ cmdlineError("\"%s\" does not appear to be a valid SQLite database", zDb1); } + { + sqlite3 *db2 = 0; + if( sqlite3_open_v2(zDb2, &db2, SQLITE_OPEN_READONLY, 0) ){ + cmdlineError("cannot open database file \"%s\"", zDb2); + } + sqlite3_close(db2); + } #ifndef SQLITE_OMIT_LOAD_EXTENSION sqlite3_enable_load_extension(g.db, 1); for(i=0; i<nExt; i++){ |