1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-06 15:49:35 +03:00

Fix a bug in the command-line shell that prevents the

reading of the ".sqliterc" file.  Ticket #2433. (CVS 4100)

FossilOrigin-Name: 6eaf29f5e1e99b066825a1ccf34c82c9da6da826
This commit is contained in:
drh
2007-06-20 13:10:00 +00:00
parent 9245c243b7
commit a959ac4588
3 changed files with 12 additions and 10 deletions

View File

@@ -12,7 +12,7 @@
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
** $Id: shell.c,v 1.162 2007/05/04 13:15:56 drh Exp $
** $Id: shell.c,v 1.163 2007/06/20 13:10:01 drh Exp $
*/
#include <stdlib.h>
#include <string.h>
@@ -1754,6 +1754,7 @@ static void process_sqliterc(
const char *sqliterc = sqliterc_override;
char *zBuf = 0;
FILE *in = NULL;
int nBuf;
if (sqliterc == NULL) {
home_dir = find_home_dir();
@@ -1761,12 +1762,13 @@ static void process_sqliterc(
fprintf(stderr,"%s: cannot locate your home directory!\n", Argv0);
return;
}
zBuf = malloc(strlen(home_dir) + 15);
nBuf = strlen(home_dir) + 16;
zBuf = malloc( nBuf );
if( zBuf==0 ){
fprintf(stderr,"%s: out of memory!\n", Argv0);
exit(1);
}
sqlite3_snprintf(sizeof(zBuf), zBuf,"%s/.sqliterc",home_dir);
sqlite3_snprintf(nBuf, zBuf,"%s/.sqliterc",home_dir);
free(home_dir);
sqliterc = (const char*)zBuf;
}