Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix the sqlite3_quota_file() function in test_quota.c so that it adds the second nul-terminator to all file names that will be passed to a VFS xOpen method. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
3013f9a67cc6097c14e40a6155c1401f |
User & Date: | dan 2012-01-11 11:20:42.615 |
Context
2012-01-11
| ||
15:47 | Make the pager less vulnerable to problems caused by shifting sector sizes when rolling back a hot journal. (check-in: 629108c8e5 user: drh tags: trunk) | |
11:20 | Fix the sqlite3_quota_file() function in test_quota.c so that it adds the second nul-terminator to all file names that will be passed to a VFS xOpen method. (check-in: 3013f9a67c user: dan tags: trunk) | |
01:01 | Prevent winOpenSharedMemory from masking the real return code from its call to winOpen. Also, add asserts to check the double-zero termination of database file names. (check-in: 93a65776dc user: mistachkin tags: trunk) | |
Changes
Changes to src/test_quota.c.
︙ | ︙ | |||
933 934 935 936 937 938 939 | */ int sqlite3_quota_file(const char *zFilename){ char *zFull; sqlite3_file *fd; int rc; int outFlags = 0; sqlite3_int64 iSize; | | | > > | > > | | | > > > < | | | | | | | | | | | | | | > > | 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 | */ int sqlite3_quota_file(const char *zFilename){ char *zFull; sqlite3_file *fd; int rc; int outFlags = 0; sqlite3_int64 iSize; int nAlloc = gQuota.sThisVfs.szOsFile + gQuota.sThisVfs.mxPathname+2; /* Allocate space for a file-handle and the full path for file zFilename */ fd = (sqlite3_file *)sqlite3_malloc(nAlloc); if( fd==0 ){ rc = SQLITE_NOMEM; }else{ zFull = &((char *)fd)[gQuota.sThisVfs.szOsFile]; rc = gQuota.pOrigVfs->xFullPathname(gQuota.pOrigVfs, zFilename, gQuota.sThisVfs.mxPathname+1, zFull); } if( rc==SQLITE_OK ){ zFull[strlen(zFull)+1] = '\0'; rc = quotaOpen(&gQuota.sThisVfs, zFull, fd, SQLITE_OPEN_READONLY | SQLITE_OPEN_MAIN_DB, &outFlags); if( rc==SQLITE_OK ){ fd->pMethods->xFileSize(fd, &iSize); fd->pMethods->xClose(fd); }else if( rc==SQLITE_CANTOPEN ){ quotaGroup *pGroup; quotaFile *pFile; quotaEnter(); pGroup = quotaGroupFind(zFull); if( pGroup ){ pFile = quotaFindFile(pGroup, zFull, 0); if( pFile ) quotaRemoveFile(pFile); } quotaLeave(); } } sqlite3_free(fd); return rc; } /* ** Open a potentially quotaed file for I/O. */ |
︙ | ︙ |