1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Better error messages when trying to open a large file using a version

of SQLite that omits large file support.  Tickets #3096 and #3094. (CVS 5085)

FossilOrigin-Name: bdd89cd231745e6bd498b2751d7ff2cf6169b3eb
This commit is contained in:
drh
2008-05-05 16:56:34 +00:00
parent 4cea5baed6
commit 65594045d0
6 changed files with 29 additions and 24 deletions

View File

@@ -617,7 +617,7 @@ static sqlite3LockingStyle sqlite3DetectLockingStyle(
** describes that file descriptor. Create new ones if necessary. The
** return values might be uninitialized if an error occurs.
**
** Return the number of errors.
** Return an appropriate error code.
*/
static int findLockInfo(
int fd, /* The file descriptor used in the key */
@@ -631,7 +631,12 @@ static int findLockInfo(
struct lockInfo *pLock;
struct openCnt *pOpen;
rc = fstat(fd, &statbuf);
if( rc!=0 ) return 1;
if( rc!=0 ){
#ifdef EOVERFLOW
if( errno==EOVERFLOW ) return SQLITE_NOLFS;
#endif
return SQLITE_IOERR;
}
memset(&key1, 0, sizeof(key1));
key1.dev = statbuf.st_dev;
@@ -650,7 +655,7 @@ static int findLockInfo(
struct lockInfo *pOld;
pLock = sqlite3_malloc( sizeof(*pLock) );
if( pLock==0 ){
rc = 1;
rc = SQLITE_NOMEM;
goto exit_findlockinfo;
}
pLock->key = key1;
@@ -661,7 +666,7 @@ static int findLockInfo(
if( pOld!=0 ){
assert( pOld==pLock );
sqlite3_free(pLock);
rc = 1;
rc = SQLITE_NOMEM;
goto exit_findlockinfo;
}
}else{
@@ -675,7 +680,7 @@ static int findLockInfo(
pOpen = sqlite3_malloc( sizeof(*pOpen) );
if( pOpen==0 ){
releaseLockInfo(pLock);
rc = 1;
rc = SQLITE_NOMEM;
goto exit_findlockinfo;
}
pOpen->key = key2;
@@ -688,7 +693,7 @@ static int findLockInfo(
assert( pOld==pOpen );
sqlite3_free(pOpen);
releaseLockInfo(pLock);
rc = 1;
rc = SQLITE_NOMEM;
goto exit_findlockinfo;
}
}else{
@@ -2189,7 +2194,7 @@ static int fillInUnixFile(
if( rc ){
if( dirfd>=0 ) close(dirfd);
close(h);
return SQLITE_NOMEM;
return rc;
}
} else {
/* pLock and pOpen are only used for posix advisory locking */
@@ -2278,7 +2283,7 @@ static int fillInUnixFile(
if( rc ){
if( dirfd>=0 ) close(dirfd);
close(h);
return SQLITE_NOMEM;
return rc;
}
OSTRACE3("OPEN %-3d %s\n", h, zFilename);