/ Check-in [66945406]
Login

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

Overview
Comment:Bug fix in the sqliteOsLock() and sqliteOsUnlock() routines of POSIX. Version 2.1.5. (CVS 325)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:669454060867593290c1ce8c45bd87d011976289
User & Date: drh 2001-12-06 13:24:15
Context
2001-12-06
13:30
Version 2.1.5 (CVS 456) check-in: 8e90ad55 user: drh tags: trunk
13:24
Bug fix in the sqliteOsLock() and sqliteOsUnlock() routines of POSIX. Version 2.1.5. (CVS 325) check-in: 66945406 user: drh tags: trunk
2001-12-05
01:00
Version 2.1.4 (CVS 457) check-in: 121c522e user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to VERSION.

1
2.1.4
|
1
2.1.5

Changes to src/os.c.

590
591
592
593
594
595
596
597
598
599
600
601
602
603


604


605
606
607
608
609
610
611
...
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641

642
643
644
645
646
647
648
      rc = SQLITE_BUSY;
    }else{
      rc = SQLITE_OK;
      needSysLock = id.pLock->cnt==0;
      id.pLock->cnt++;
    }
  }
  sqliteOsLeaveMutex();      
  if( rc==SQLITE_OK && needSysLock ){ 
    struct flock lock;
    lock.l_type = wrlock ? F_WRLCK : F_RDLCK;
    lock.l_whence = SEEK_SET;
    lock.l_start = lock.l_len = 0L;
    rc = fcntl(id.fd, F_SETLK, &lock)==0 ? SQLITE_OK : SQLITE_BUSY;


  }


  return rc;
#endif
#if OS_WIN
  if( !LockFile(id, 0, 0, 1024, 0) ){
    return SQLITE_BUSY;
  }
  return SQLITE_OK;
................................................................................
  }else if( id.pLock->cnt>0 ){
    id.pLock->cnt--;
    needSysUnlock = id.pLock->cnt==0;
  }else{
    rc = SQLITE_OK;
    needSysUnlock = 0;
  }
  sqliteOsLeaveMutex();
  if( needSysUnlock ){
    struct flock lock;
    lock.l_type = F_UNLCK;
    lock.l_whence = SEEK_SET;
    lock.l_start = lock.l_len = 0L;
    rc = fcntl(id.fd, F_SETLK, &lock)==0 ? SQLITE_OK : SQLITE_IOERR;
  }

  return rc;
#endif
#if OS_WIN
  return UnlockFile(id, 0, 0, 1024, 0) ? SQLITE_OK : SQLITE_IOERR;
#endif
}








<






>
>
|
>
>







 







<







>







590
591
592
593
594
595
596

597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
...
630
631
632
633
634
635
636

637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
      rc = SQLITE_BUSY;
    }else{
      rc = SQLITE_OK;
      needSysLock = id.pLock->cnt==0;
      id.pLock->cnt++;
    }
  }

  if( rc==SQLITE_OK && needSysLock ){ 
    struct flock lock;
    lock.l_type = wrlock ? F_WRLCK : F_RDLCK;
    lock.l_whence = SEEK_SET;
    lock.l_start = lock.l_len = 0L;
    rc = fcntl(id.fd, F_SETLK, &lock)==0 ? SQLITE_OK : SQLITE_BUSY;
    if( rc ){
      id.pLock->cnt = 0;
    }
  }
  sqliteOsLeaveMutex();      
  return rc;
#endif
#if OS_WIN
  if( !LockFile(id, 0, 0, 1024, 0) ){
    return SQLITE_BUSY;
  }
  return SQLITE_OK;
................................................................................
  }else if( id.pLock->cnt>0 ){
    id.pLock->cnt--;
    needSysUnlock = id.pLock->cnt==0;
  }else{
    rc = SQLITE_OK;
    needSysUnlock = 0;
  }

  if( needSysUnlock ){
    struct flock lock;
    lock.l_type = F_UNLCK;
    lock.l_whence = SEEK_SET;
    lock.l_start = lock.l_len = 0L;
    rc = fcntl(id.fd, F_SETLK, &lock)==0 ? SQLITE_OK : SQLITE_IOERR;
  }
  sqliteOsLeaveMutex();
  return rc;
#endif
#if OS_WIN
  return UnlockFile(id, 0, 0, 1024, 0) ? SQLITE_OK : SQLITE_IOERR;
#endif
}

Changes to www/changes.tcl.

12
13
14
15
16
17
18







19
20
21
22
23
24
25
}


proc chng {date desc} {
  puts "<DT><B>$date</B></DT>"
  puts "<DD><P><UL>$desc</UL></P></DD>"
}








chng {2001 Dec 4 (2.1.4)} {
<li>Sometimes <b>sqlite_exec()</b> would return SQLITE_PROTOCOL when it
    should have returned SQLITE_BUSY.</li>
<li>The fix to the previous bug uncovered a deadlock which was also
    fixed.</li>
<li>Add the ability to put a single .command in the second argument







>
>
>
>
>
>
>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
}


proc chng {date desc} {
  puts "<DT><B>$date</B></DT>"
  puts "<DD><P><UL>$desc</UL></P></DD>"
}

chng {2001 Dec 6 (2.1.5)} {
<li>Fix for another problem (unrelated to the one fixed in 2.1.4) 
    that sometimes causes <b>sqlite_exec()</b> to return SQLITE_PROTOCOL
    unnecessarily.  This time the bug was
    in the POSIX locking code and should not effect windows users.</li>
}

chng {2001 Dec 4 (2.1.4)} {
<li>Sometimes <b>sqlite_exec()</b> would return SQLITE_PROTOCOL when it
    should have returned SQLITE_BUSY.</li>
<li>The fix to the previous bug uncovered a deadlock which was also
    fixed.</li>
<li>Add the ability to put a single .command in the second argument