SQLite

Check-in [ab3a5539db]
Login

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

Overview
Comment:Proposed fix for the use of posix_fallocate() so that it handles EINVAL returns correctly.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | einval-from-fallocate
Files: files | file ages | folders
SHA3-256: ab3a5539db82814cafb832cdaebd1e14566139306453ef9cdba6b244a994fe0b
User & Date: drh 2018-06-02 14:37:39.510
Context
2018-06-02
19:01
Fix the usage of posix_fallocate() so that it correctly responds to EINVAL returns. (check-in: ce2c3e7a87 user: drh tags: trunk)
14:37
Proposed fix for the use of posix_fallocate() so that it handles EINVAL returns correctly. (Closed-Leaf check-in: ab3a5539db user: drh tags: einval-from-fallocate)
12:05
Fix the CSV extension so that it works with single-column CSV files. (check-in: e336cf0048 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/os_unix.c.
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
      /* The code below is handling the return value of osFallocate() 
      ** correctly. posix_fallocate() is defined to "returns zero on success, 
      ** or an error number on  failure". See the manpage for details. */
      int err;
      do{
        err = osFallocate(pFile->h, buf.st_size, nSize-buf.st_size);
      }while( err==EINTR );
      if( err ) return SQLITE_IOERR_WRITE;
#else
      /* If the OS does not have posix_fallocate(), fake it. Write a 
      ** single byte to the last byte in each block that falls entirely
      ** within the extended region. Then, if required, a single byte
      ** at offset (nSize-1), to set the size of the file correctly.
      ** This is a similar technique to that used by glibc on systems
      ** that do not have a real fallocate() call.







|







3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
      /* The code below is handling the return value of osFallocate() 
      ** correctly. posix_fallocate() is defined to "returns zero on success, 
      ** or an error number on  failure". See the manpage for details. */
      int err;
      do{
        err = osFallocate(pFile->h, buf.st_size, nSize-buf.st_size);
      }while( err==EINTR );
      if( err && err!=EINVAL ) return SQLITE_IOERR_WRITE;
#else
      /* If the OS does not have posix_fallocate(), fake it. Write a 
      ** single byte to the last byte in each block that falls entirely
      ** within the extended region. Then, if required, a single byte
      ** at offset (nSize-1), to set the size of the file correctly.
      ** This is a similar technique to that used by glibc on systems
      ** that do not have a real fallocate() call.