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

Check at the write() call to work around the msdos bug in OSX actually

succeeds and throw an error if it does not.  #ifdef out the work-around
for all platforms other than OSX.  Ticket #3633. (CVS 6237)

FossilOrigin-Name: b054b569172c53f4e185e4a64f41d08784aa0f8b
This commit is contained in:
drh
2009-02-03 15:27:02 +00:00
parent f158162191
commit eb0d74ff39
3 changed files with 14 additions and 9 deletions

View File

@@ -43,7 +43,7 @@
** * Definitions of sqlite3_vfs objects for all locking methods
** plus implementations of sqlite3_os_init() and sqlite3_os_end().
**
** $Id: os_unix.c,v 1.238 2009/01/16 23:47:42 drh Exp $
** $Id: os_unix.c,v 1.239 2009/02/03 15:27:02 drh Exp $
*/
#include "sqliteInt.h"
#if SQLITE_OS_UNIX /* This file is used on unix only */
@@ -920,6 +920,7 @@ static int findLockInfo(
return SQLITE_IOERR;
}
#ifdef __APPLE__
/* On OS X on an msdos filesystem, the inode number is reported
** incorrectly for zero-size files. See ticket #3260. To work
** around this problem (we consider it a bug in OS X, not SQLite)
@@ -931,13 +932,17 @@ static int findLockInfo(
** the first page of the database, no damage is done.
*/
if( statbuf.st_size==0 ){
write(fd, "S", 1);
rc = write(fd, "S", 1);
if( rc!=1 ){
return SQLITE_IOERR;
}
rc = fstat(fd, &statbuf);
if( rc!=0 ){
pFile->lastErrno = errno;
return SQLITE_IOERR;
}
}
#endif
memset(&lockKey, 0, sizeof(lockKey));
lockKey.fid.dev = statbuf.st_dev;