/ Check-in [20a8c611]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make sure the open_db() routine in the CLI does not invoke access() with a NULL filename.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:20a8c61122f37a43c418ca4415b3d26e0f7a27a6faea9048aa9fbb1a56e9d629
User & Date: drh 2018-05-11 15:10:11
Context
2018-05-11
15:10
Fix a typo in the help message from the ".sha3sum" command in the CLI. check-in: dba87a20 user: drh tags: trunk
15:10
Make sure the open_db() routine in the CLI does not invoke access() with a NULL filename. check-in: 20a8c611 user: drh tags: trunk
14:00
Make sure the open_db() routine in the CLI does not invoke access() with a NULL filename. check-in: 2b8fd3b4 user: drh tags: geojson
2018-05-09
16:32
Add a test case to check that the fts5 unicode64 tokenizer is dealing with codepoints greater than 65535 correctly. check-in: 9f7a6ae8 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/shell.c.in.

  3569   3569   
  3570   3570   /*
  3571   3571   ** Make sure the database is open.  If it is not, then open it.  If
  3572   3572   ** the database fails to open, print an error message and exit.
  3573   3573   */
  3574   3574   static void open_db(ShellState *p, int keepAlive){
  3575   3575     if( p->db==0 ){
  3576         -    if( p->openMode==SHELL_OPEN_UNSPEC && access(p->zDbFilename,0)==0 ){
  3577         -      p->openMode = (u8)deduceDatabaseType(p->zDbFilename, 0);
         3576  +    if( p->openMode==SHELL_OPEN_UNSPEC ){
         3577  +      if( p->zDbFilename==0 || p->zDbFilename[0]==0 ){
         3578  +        p->openMode = SHELL_OPEN_NORMAL;
         3579  +      }else if( access(p->zDbFilename,0)==0 ){
         3580  +        p->openMode = (u8)deduceDatabaseType(p->zDbFilename, 0);
         3581  +      }
  3578   3582       }
  3579   3583       switch( p->openMode ){
  3580   3584         case SHELL_OPEN_APPENDVFS: {
  3581   3585           sqlite3_open_v2(p->zDbFilename, &p->db, 
  3582   3586              SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE, "apndvfs");
  3583   3587           break;
  3584   3588         }