/ Check-in [e4408dd1]
Login

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

Overview
Comment:Check the return value of lseek() in os_unix.c to make sure it really worked. (CVS 3628)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:e4408dd1fd32e6c5057cce0fdfa70eb2d9bd2531
User & Date: drh 2007-02-06 11:11:08
Context
2007-02-06
13:26
When optimizing out an ORDER BY clause due to uniqueness constraints, make sure unused terms to the right in the ORDER BY clause to not reference other tables in a join. Ticket #2211. Additional test cases needed before closing this ticket. (CVS 3629) check-in: 912faf18 user: drh tags: trunk
11:11
Check the return value of lseek() in os_unix.c to make sure it really worked. (CVS 3628) check-in: e4408dd1 user: drh tags: trunk
2007-02-05
14:21
Set the MEM_Term flag when an internal string has a nul-terminator appended to it. Fix for #2213. (CVS 3627) check-in: fc969ad9 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to src/os_unix.c.

   996    996   
   997    997   /*
   998    998   ** Seek to the offset in id->offset then read cnt bytes into pBuf.
   999    999   ** Return the number of bytes actually read.  Update the offset.
  1000   1000   */
  1001   1001   static int seekAndRead(unixFile *id, void *pBuf, int cnt){
  1002   1002     int got;
         1003  +  i64 newOffset;
  1003   1004   #ifdef USE_PREAD
  1004   1005     got = pread(id->h, pBuf, cnt, id->offset);
  1005   1006   #else
  1006         -  lseek(id->h, id->offset, SEEK_SET);
         1007  +  newOffset = lseek(id->h, id->offset, SEEK_SET);
         1008  +  if( newOffset!=id->offset ){
         1009  +    return -1;
         1010  +  }
  1007   1011     got = read(id->h, pBuf, cnt);
  1008   1012   #endif
  1009   1013     if( got>0 ){
  1010   1014       id->offset += got;
  1011   1015     }
  1012   1016     return got;
  1013   1017   }
................................................................................
  1039   1043   
  1040   1044   /*
  1041   1045   ** Seek to the offset in id->offset then read cnt bytes into pBuf.
  1042   1046   ** Return the number of bytes actually read.  Update the offset.
  1043   1047   */
  1044   1048   static int seekAndWrite(unixFile *id, const void *pBuf, int cnt){
  1045   1049     int got;
         1050  +  i64 newOffset;
  1046   1051   #ifdef USE_PREAD
  1047   1052     got = pwrite(id->h, pBuf, cnt, id->offset);
  1048   1053   #else
  1049         -  lseek(id->h, id->offset, SEEK_SET);
         1054  +  newOffset = lseek(id->h, id->offset, SEEK_SET);
         1055  +  if( newOffset!=id->offset ){
         1056  +    return -1;
         1057  +  }
  1050   1058     got = write(id->h, pBuf, cnt);
  1051   1059   #endif
  1052   1060     if( got>0 ){
  1053   1061       id->offset += got;
  1054   1062     }
  1055   1063     return got;
  1056   1064   }