SQLite

Check-in [30ed7a4b64]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Always use utimes() instead of utimensat() since the latter is not available even on some recent unix systems.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 30ed7a4b6408f0ca921abc4d8b7bb5404fc7708cedcd104b017b361054e7148c
User & Date: drh 2018-01-12 14:34:45.816
Context
2018-01-12
17:25
Include changes made to the sqlite_stat1 table in changesets generated by the sessions module. sqlite_stat1 entries in such changesets are ignored by legacy clients. (check-in: 2064233533 user: dan tags: trunk)
14:34
Always use utimes() instead of utimensat() since the latter is not available even on some recent unix systems. (check-in: 30ed7a4b64 user: drh tags: trunk)
12:02
Add a test to ensure that the sqlite3changeset_apply() function ignores tables that do not have the expected primary keys. (check-in: bf2daf0627 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to ext/misc/fileio.c.
82
83
84
85
86
87
88

89
90
91
92
93
94
95
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#if !defined(_WIN32) && !defined(WIN32)
#  include <unistd.h>
#  include <dirent.h>
#  include <utime.h>

#else
#  include "windows.h"
#  include <io.h>
#  include <direct.h>
#  include "test_windirent.h"
#  define dirent DIRENT
#  ifndef stat







>







82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#if !defined(_WIN32) && !defined(WIN32)
#  include <unistd.h>
#  include <dirent.h>
#  include <utime.h>
#  include <sys/time.h>
#else
#  include "windows.h"
#  include <io.h>
#  include <direct.h>
#  include "test_windirent.h"
#  define dirent DIRENT
#  ifndef stat
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
    if( hFile!=INVALID_HANDLE_VALUE ){
      BOOL bResult = SetFileTime(hFile, NULL, &lastAccess, &lastWrite);
      CloseHandle(hFile);
      return !bResult;
    }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;







|







282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
    if( hFile!=INVALID_HANDLE_VALUE ){
      BOOL bResult = SetFileTime(hFile, NULL, &lastAccess, &lastWrite);
      CloseHandle(hFile);
      return !bResult;
    }else{
      return 1;
    }
#elif defined(AT_FDCWD) && 0 /* utimensat() is not univerally available */
    /* 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;