/ Check-in [e8566cf5]
Login

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

Overview
Comment:Fix segfault that occurs when opening a non-existing database in the shell then immediately doing ".q". (CVS 986)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:e8566cf5a381fa7655caacbc0fe95091e1137fea
User & Date: drh 2003-05-19 23:55:30
Context
2003-05-29
04:21
Added typeof() operator. Minor additions for ATTACH/DETACH. (CVS 987) check-in: 8b8fa0ff user: jplyon tags: trunk
2003-05-19
23:55
Fix segfault that occurs when opening a non-existing database in the shell then immediately doing ".q". (CVS 986) check-in: e8566cf5 user: drh tags: trunk
2003-05-17
19:23
Additional attach testing. I now believe that ticket #317 was fixed by check-in (981). (CVS 985) check-in: 24191373 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/shell.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
** $Id: shell.c,v 1.79 2003/05/13 00:24:41 drh Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "sqlite.h"
#include <ctype.h>

................................................................................
    }
    if( nArg >= 3) {
      strncpy(continuePrompt,azArg[2],(int)ArraySize(continuePrompt)-1);
    }
  }else

  if( c=='q' && strncmp(azArg[0], "quit", n)==0 ){
    sqlite_close(p->db);
    exit(0);
  }else

  if( c=='r' && strncmp(azArg[0], "read", n)==0 && nArg==2 ){
    FILE *alt = fopen(azArg[1], "r");
    if( alt==0 ){
      fprintf(stderr,"can't open \"%s\"\n", azArg[1]);







|







 







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
** $Id: shell.c,v 1.80 2003/05/19 23:55:30 drh Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "sqlite.h"
#include <ctype.h>

................................................................................
    }
    if( nArg >= 3) {
      strncpy(continuePrompt,azArg[2],(int)ArraySize(continuePrompt)-1);
    }
  }else

  if( c=='q' && strncmp(azArg[0], "quit", n)==0 ){
    if( p->db ) sqlite_close(p->db);
    exit(0);
  }else

  if( c=='r' && strncmp(azArg[0], "read", n)==0 && nArg==2 ){
    FILE *alt = fopen(azArg[1], "r");
    if( alt==0 ){
      fprintf(stderr,"can't open \"%s\"\n", azArg[1]);