mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Only require double-zero terminators on database filenames, not any every
files supplied to the xOpen method. This backs out [2544f233f1]. Also refactor the fillInUnixFile() routine in os_unix.c to reduce the number of parameters. FossilOrigin-Name: cb774b26e13745cfad0d76a71e47466d703e0007
This commit is contained in:
10
src/test3.c
10
src/test3.c
@@ -66,6 +66,8 @@ static int btree_open(
|
||||
Btree *pBt;
|
||||
int rc, nCache;
|
||||
char zBuf[100];
|
||||
int n;
|
||||
char *zFilename;
|
||||
if( argc!=3 ){
|
||||
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
|
||||
" FILENAME NCACHE FLAGS\"", 0);
|
||||
@@ -78,8 +80,14 @@ static int btree_open(
|
||||
sDb.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_RECURSIVE);
|
||||
sqlite3_mutex_enter(sDb.mutex);
|
||||
}
|
||||
rc = sqlite3BtreeOpen(sDb.pVfs, argv[1], &sDb, &pBt, 0,
|
||||
n = strlen(argv[1]);
|
||||
zFilename = sqlite3_malloc( n+2 );
|
||||
if( zFilename==0 ) return TCL_ERROR;
|
||||
memcpy(zFilename, argv[1], n+1);
|
||||
zFilename[n+1] = 0;
|
||||
rc = sqlite3BtreeOpen(sDb.pVfs, zFilename, &sDb, &pBt, 0,
|
||||
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_MAIN_DB);
|
||||
sqlite3_free(zFilename);
|
||||
if( rc!=SQLITE_OK ){
|
||||
Tcl_AppendResult(interp, errorName(rc), 0);
|
||||
return TCL_ERROR;
|
||||
|
Reference in New Issue
Block a user