]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Avoid the use of utimensat() on older unix platforms.
authordrh <drh@noemail.net>
Sun, 7 Jan 2018 23:28:10 +0000 (23:28 +0000)
committerdrh <drh@noemail.net>
Sun, 7 Jan 2018 23:28:10 +0000 (23:28 +0000)
FossilOrigin-Name: 90cb01d8d6ac12d0b88f2952a75aeefa81ba66f5e4a5377fdd8b9f86aec8e927

ext/misc/fileio.c
manifest
manifest.uuid

index 030b417e40514d601f2d5e3b753d0258a4860925..bb87f9524d426e8801b428bd426546bdca83b095 100644 (file)
@@ -261,15 +261,8 @@ static int writeFile(
   }
 
   if( mtime>=0 ){
-#if !defined(_WIN32) && !defined(WIN32)
-    struct timespec times[2];
-    times[0].tv_nsec = times[1].tv_nsec = 0;
-    times[0].tv_sec = time(0);
-    times[1].tv_sec = mtime;
-    if( utimensat(AT_FDCWD, zFile, times, AT_SYMLINK_NOFOLLOW) ){
-      return 1;
-    }
-#else
+#if defined(_WIN32)
+    /* Windows */
     FILETIME lastAccess;
     FILETIME lastWrite;
     SYSTEMTIME currentTime;
@@ -291,6 +284,24 @@ static int writeFile(
     }else{
       return 1;
     }
+#elif defined(AT_FDCWD)
+    /* Recent unix */
+    struct timespec times[2];
+    times[0].tv_nsec = times[1].tv_nsec = 0;
+    times[0].tv_sec = time(0);
+    times[1].tv_sec = mtime;
+    if( utimensat(AT_FDCWD, zFile, times, AT_SYMLINK_NOFOLLOW) ){
+      return 1;
+    }
+#else
+    /* Legacy unix */
+    struct timeval times[2];
+    times[0].tv_usec = times[1].tv_usec = 0;
+    times[0].tv_sec = time(0);
+    times[1].tv_sec = mtime;
+    if( utimes(zFile, times) ){
+      return 1;
+    }
 #endif
   }
 
index 68cc1c4a7c529213aa2eff685d8a6859b4fd4327..15727841f841aabbf25a2d33e4ff0e29a758a6de 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Remove\sthe\sdependency\son\stest_windirent.h\sfrom\sthe\sgenerated\sshell.c\sfile.
-D 2018-01-07T21:58:17.629
+C Avoid\sthe\suse\sof\sutimensat()\son\solder\sunix\splatforms.
+D 2018-01-07T23:28:10.983
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F Makefile.in 12b6daa4bdb03fa87da27cbc205ff88ace645475b5be79414a3038b68ade14cb
@@ -277,7 +277,7 @@ F ext/misc/compress.c dd4f8a6d0baccff3c694757db5b430f3bbd821d8686d1fc24df55cf9f0
 F ext/misc/csv.c 1a009b93650732e22334edc92459c4630b9fa703397cbb3c8ca279921a36ca11
 F ext/misc/dbdump.c 3509fa6b8932d04e932d6b6b827b6a82ca362781b8e8f3c77336f416793e215e
 F ext/misc/eval.c f971962e92ebb8b0a4e6b62949463ee454d88fa2
-F ext/misc/fileio.c f16e2ef87928b768883b259b6c53a67076e98e8daa0bbb624910406d59630b26
+F ext/misc/fileio.c 672e89e125846848e07e025cbe601dc370a93433d571d9422541a9cefbd12b76
 F ext/misc/fuzzer.c 7c64b8197bb77b7d64eff7cac7848870235d4c25
 F ext/misc/ieee754.c f190d0cc5182529acb15babd177781be1ac1718c
 F ext/misc/json1.c dbe086615b9546c156bf32b9378fc09383b58bd17513b866cfd24c1e15281984
@@ -1697,7 +1697,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 67c4a8c6881e33b830aa27c80e7e3d697a4222939edd77cd5ca77ece16471ea4
-R 197244392d7f5491887179479c1074da
+P 0a50c9e3bb0dbdaaec819ac6453276ba287b475ea322918ddda1ab3a1ec4b58b
+R 1b4834f0a49c166cef0f6faa748094c7
 U drh
-Z 398e4f42db7ae412d7f484f52a78c5ae
+Z 0323f752d28821f22e44c20f1850c6dd
index cd48fce8f80dac5596e7f4d14ce1cd616bd7f1b4..253d7c078ed0aa3a8e2f56fd5027aeded0d08a3c 100644 (file)
@@ -1 +1 @@
-0a50c9e3bb0dbdaaec819ac6453276ba287b475ea322918ddda1ab3a1ec4b58b
\ No newline at end of file
+90cb01d8d6ac12d0b88f2952a75aeefa81ba66f5e4a5377fdd8b9f86aec8e927
\ No newline at end of file