/ 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 Unified Diffs Show Whitespace Changes Patch

Changes to src/os_unix.c.

996
997
998
999
1000
1001
1002

1003
1004
1005
1006



1007
1008
1009
1010
1011
1012
1013
....
1039
1040
1041
1042
1043
1044
1045

1046
1047
1048
1049



1050
1051
1052
1053
1054
1055
1056

/*
** Seek to the offset in id->offset then read cnt bytes into pBuf.
** Return the number of bytes actually read.  Update the offset.
*/
static int seekAndRead(unixFile *id, void *pBuf, int cnt){
  int got;

#ifdef USE_PREAD
  got = pread(id->h, pBuf, cnt, id->offset);
#else
  lseek(id->h, id->offset, SEEK_SET);



  got = read(id->h, pBuf, cnt);
#endif
  if( got>0 ){
    id->offset += got;
  }
  return got;
}
................................................................................

/*
** Seek to the offset in id->offset then read cnt bytes into pBuf.
** Return the number of bytes actually read.  Update the offset.
*/
static int seekAndWrite(unixFile *id, const void *pBuf, int cnt){
  int got;

#ifdef USE_PREAD
  got = pwrite(id->h, pBuf, cnt, id->offset);
#else
  lseek(id->h, id->offset, SEEK_SET);



  got = write(id->h, pBuf, cnt);
#endif
  if( got>0 ){
    id->offset += got;
  }
  return got;
}







>



|
>
>
>







 







>



|
>
>
>







996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
....
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064

/*
** Seek to the offset in id->offset then read cnt bytes into pBuf.
** Return the number of bytes actually read.  Update the offset.
*/
static int seekAndRead(unixFile *id, void *pBuf, int cnt){
  int got;
  i64 newOffset;
#ifdef USE_PREAD
  got = pread(id->h, pBuf, cnt, id->offset);
#else
  newOffset = lseek(id->h, id->offset, SEEK_SET);
  if( newOffset!=id->offset ){
    return -1;
  }
  got = read(id->h, pBuf, cnt);
#endif
  if( got>0 ){
    id->offset += got;
  }
  return got;
}
................................................................................

/*
** Seek to the offset in id->offset then read cnt bytes into pBuf.
** Return the number of bytes actually read.  Update the offset.
*/
static int seekAndWrite(unixFile *id, const void *pBuf, int cnt){
  int got;
  i64 newOffset;
#ifdef USE_PREAD
  got = pwrite(id->h, pBuf, cnt, id->offset);
#else
  newOffset = lseek(id->h, id->offset, SEEK_SET);
  if( newOffset!=id->offset ){
    return -1;
  }
  got = write(id->h, pBuf, cnt);
#endif
  if( got>0 ){
    id->offset += got;
  }
  return got;
}