]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fixed incorrect typecast for flock structure ptr in fcntl() call in sqlite3TestLockin...
authoraswift <aswift@noemail.net>
Wed, 31 Jan 2007 23:37:07 +0000 (23:37 +0000)
committeraswift <aswift@noemail.net>
Wed, 31 Jan 2007 23:37:07 +0000 (23:37 +0000)
Restored previous fullfsync behavior, try fsync() if fcntl(fd, F_FULLFSYNC, 0) returns an error. (CVS 3621)

FossilOrigin-Name: f044c5f49f116ede8ab2d5ab43caa5ca9dd54ffe

manifest
manifest.uuid
src/os_unix.c

index 850d67a6b60c4c0130f946968b34227abf7f9cae..63f99019ac3ab75657111e2ac60646e432ddd058 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Replace\sthe\srandomHex()\sfunction\swith\sseparate\sfunctions\nrandomBlob()\sand\shex().\s(CVS\s3620)
-D 2007-01-29T17:58:28
+C Fixed\sincorrect\stypecast\sfor\sflock\sstructure\sptr\sin\sfcntl()\scall\sin\ssqlite3TestLockingStyle()\nRestored\sprevious\sfullfsync\sbehavior,\stry\sfsync()\sif\sfcntl(fd,\sF_FULLFSYNC,\s0)\sreturns\san\serror.\s(CVS\s3621)
+D 2007-01-31T23:37:08
 F Makefile.in 7fa74bf4359aa899da5586e394d17735f221315f
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -81,7 +81,7 @@ F src/os_os2.c 8ee8207fe218a1acf3a31d59753e165e5c23bb95
 F src/os_os2.h e5f17dd69333632bbc3112881ea407c37d245eb3
 F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
 F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
-F src/os_unix.c 9fbbd8ab0a6b3992370ba0f3aae11feff2a78c96
+F src/os_unix.c 09d422370948fb5087a2873ac81470ef2f943559
 F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
 F src/os_win.c 8736cf3a49fd651a6538857480f302807d57814c
 F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
@@ -428,7 +428,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P a6001589ab1349f7a6b4af941e9e0fd73d13c1c0
-R 81b8a9e1e2346eee4d0809c0a57c1d63
-U drh
-Z e549908b92c57478539350b74a145cc3
+P f5ad74a9bc57e83c11beb3cf46bb6cd8c9de3f86
+R d922c31b26825f5a2b46c299309ad84f
+U aswift
+Z e656fc55ef70643d3663c6aa79db09b7
index 77999ec5496b5796e5ad7ba5e34a999526b6ea40..dffff041cf58fef57883946a5cf3c187f0a99266 100644 (file)
@@ -1 +1 @@
-f5ad74a9bc57e83c11beb3cf46bb6cd8c9de3f86
\ No newline at end of file
+f044c5f49f116ede8ab2d5ab43caa5ca9dd54ffe
\ No newline at end of file
index d7f05ac14bf36b176b2a1b9cae11114a1dbaf1fd..c5fa2c0ed0c28c080444506f2d5179a72b3dd98b 100644 (file)
@@ -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;