chiark / gitweb /
@@ -1,4 +1,4 @@
authorian <ian>
Sun, 25 Mar 2007 19:24:44 +0000 (19:24 +0000)
committerian <ian>
Sun, 25 Mar 2007 19:24:44 +0000 (19:24 +0000)
-chiark-tcl (1.0.2) unstable; urgency=low
+chiark-tcl (1.0.2~~iwj) unstable; urgency=low

   New features:
   * hbcrypto hash-{init,update,final} etc. for incremental hashing.
@@ -12,6 +12,8 @@
     Closes #393970.  (Bug exists only where int and ssize_t differ.)
   * Use correct errno value for error writing to new .main during compact.
   * Do not coredump if fclose journal fails during compact.
+  * Do not fail lookups on cdb-wr's opened from just-created dbs.
+  * Do not leak cdb innards on compact.

   Portability fixes:
   * Remove unecessary assertion of val<=0xffffffffUL where uint32_t val;
@@ -21,7 +23,7 @@
   * Add a few assertions about *_LLEN in adns.c.
   * Comprehensive review of use of `int' and defence against overflow.

- --
+ -- Ian Jackson <ian@davenant.greenend.org.uk>  Sun, 25 Mar 2007 20:13:20 +0100

 chiark-tcl (1.0.1) unstable; urgency=low

cdb/writeable.c
debian/changelog

index 02c98cb8ad773230984f454f02f8b3205d826213..2fdfc6044e39421e1452c0beffaed87f7250fbfa 100644 (file)
@@ -170,13 +170,17 @@ typedef struct Rw {
   ScriptToInvoke on_info, on_lexminval;
 } Rw;
 
+static void rw_cdb_close(Tcl_Interp *ip, Rw *rw) {
+  if (rw->cdb_fd >= 0) cdb_free(&rw->cdb);
+  maybe_close(rw->cdb_fd);
+}
+
 static int rw_close(Tcl_Interp *ip, Rw *rw) {
   int rc, r;
 
   rc= TCL_OK;
   ht_destroy(&rw->logincore);
-  if (rw->cdb_fd >= 0) cdb_free(&rw->cdb);
-  maybe_close(rw->cdb_fd);
+  rw_cdb_close(ip,rw);
   maybe_close(rw->lock_fd);
 
   if (rw->logfile) {
@@ -414,7 +418,7 @@ static int infocb(Tcl_Interp *ip, Rw *rw, const char *arg1,
 /*---------- Opening ----------*/
 
 static int cdbinit(Tcl_Interp *ip, Rw *rw) {
-  /* On entry, cdb_fd >=0 but cdb is _undefined_/
+  /* On entry, cdb_fd >=0 but cdb is _undefined_
    * On exit, either cdb_fd<0 or cdb is initialised */
   int r, rc;
   
@@ -813,8 +817,7 @@ static int compact_keepopen(Tcl_Interp *ip, Rw *rw, int force) {
 
   rc= compact_core(ip, rw, logsz, &reccount);  if (rc) goto x_rc;
 
-  maybe_close(rw->cdb_fd);
-  rw->cdb_fd= -1;
+  rw_cdb_close(ip,rw);
   ht_destroy(&rw->logincore);
   ht_setup(&rw->logincore);
 
@@ -948,11 +951,18 @@ static int lookup_rw(Tcl_Interp *ip, void *rw_v, const char *key,
   val= ht_lookup(&rw->logincore, key);
   if (val) {
     if (val->len) { *data_r= val->data; *len_r= val->len; return TCL_OK; }
-    else { *data_r= 0; *len_r= -1; return TCL_OK; }
+    else goto not_found;
   }
 
+  if (rw->cdb_fd<0) goto not_found;
+
   return cht_cdb_lookup_cdb(ip, &rw->cdb, key, strlen(key), data_r, len_r);
-} 
+
+ not_found:
+  *data_r= 0;
+  *len_r= -1;
+  return TCL_OK;
+}
 
 int cht_do_cdbwr_lookup(ClientData cd, Tcl_Interp *ip, void *rw_v,
                        const char *key, Tcl_Obj *def,
index 644a3c5faeac0a9e92c50716b632a711faf73a54..e57556ccab4ceb5641c748ff75502f5e84854068 100644 (file)
@@ -1,4 +1,4 @@
-chiark-tcl (1.0.2) unstable; urgency=low
+chiark-tcl (1.0.2~~iwj) unstable; urgency=low
 
   New features:
   * hbcrypto hash-{init,update,final} etc. for incremental hashing.
@@ -12,6 +12,8 @@ chiark-tcl (1.0.2) unstable; urgency=low
     Closes #393970.  (Bug exists only where int and ssize_t differ.)
   * Use correct errno value for error writing to new .main during compact.
   * Do not coredump if fclose journal fails during compact.
+  * Do not fail lookups on cdb-wr's opened from just-created dbs.
+  * Do not leak cdb innards on compact.
 
   Portability fixes:
   * Remove unecessary assertion of val<=0xffffffffUL where uint32_t val;
@@ -21,7 +23,7 @@ chiark-tcl (1.0.2) unstable; urgency=low
   * Add a few assertions about *_LLEN in adns.c.
   * Comprehensive review of use of `int' and defence against overflow.
 
- --
+ -- Ian Jackson <ian@davenant.greenend.org.uk>  Sun, 25 Mar 2007 20:13:20 +0100
 
 chiark-tcl (1.0.1) unstable; urgency=low