aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoraswift <aswift@noemail.net>2007-01-31 23:37:07 +0000
committeraswift <aswift@noemail.net>2007-01-31 23:37:07 +0000
commitae0943b4450c8409fa724c8accbbfb08b02b915b (patch)
treef0f124409803628ac2e3868a0ebf2322a3838ee7 /src
parent137c728f5aeb7fc57a27975cbba7306b33c7c4cd (diff)
downloadsqlite-ae0943b4450c8409fa724c8accbbfb08b02b915b.tar.gz
sqlite-ae0943b4450c8409fa724c8accbbfb08b02b915b.zip
Fixed incorrect typecast for flock structure ptr in fcntl() call in sqlite3TestLockingStyle()
Restored previous fullfsync behavior, try fsync() if fcntl(fd, F_FULLFSYNC, 0) returns an error. (CVS 3621) FossilOrigin-Name: f044c5f49f116ede8ab2d5ab43caa5ca9dd54ffe
Diffstat (limited to 'src')
-rw-r--r--src/os_unix.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index d7f05ac14..c5fa2c0ed 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -565,7 +565,7 @@ static sqlite3LockingStyle sqlite3TestLockingStyle(const char *filePath,
lockInfo.l_whence = SEEK_SET;
lockInfo.l_type = F_RDLCK;
- if (fcntl(fd, F_GETLK, (int) &lockInfo) != -1) {
+ if (fcntl(fd, F_GETLK, &lockInfo) != -1) {
return posixLockingStyle;
}
@@ -1160,13 +1160,26 @@ static int full_fsync(int fd, int fullSync, int dataOnly){
#if HAVE_FULLFSYNC
if( fullSync ){
rc = fcntl(fd, F_FULLFSYNC, 0);
- }else
-#endif /* HAVE_FULLFSYNC */
+ }else{
+ rc = 1;
+ }
+ /* If the FULLFSYNC failed, fall back to attempting an fsync().
+ * It shouldn't be possible for fullfsync to fail on the local
+ * file system (on OSX), so failure indicates that FULLFSYNC
+ * isn't supported for this file system. So, attempt an fsync
+ * and (for now) ignore the overhead of a superfluous fcntl call.
+ * It'd be better to detect fullfsync support once and avoid
+ * the fcntl call every time sync is called.
+ */
+ if( rc ) rc = fsync(fd);
+
+#else
if( dataOnly ){
rc = fdatasync(fd);
}else{
rc = fsync(fd);
}
+#endif /* HAVE_FULLFSYNC */
#endif /* defined(SQLITE_NO_SYNC) */
return rc;