[Gpg4win-commits] r1602 - trunk/patches/dirmngr-1.1.0

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Dec 17 16:48:09 CET 2010


Author: werner
Date: 2010-12-17 16:48:09 +0100 (Fri, 17 Dec 2010)
New Revision: 1602

Modified:
   trunk/patches/dirmngr-1.1.0/01-mmap.patch
Log:
Extend patch


Modified: trunk/patches/dirmngr-1.1.0/01-mmap.patch
===================================================================
--- trunk/patches/dirmngr-1.1.0/01-mmap.patch	2010-12-17 14:55:25 UTC (rev 1601)
+++ trunk/patches/dirmngr-1.1.0/01-mmap.patch	2010-12-17 15:48:09 UTC (rev 1602)
@@ -10,7 +10,13 @@
 	(cdb_free) [W32]: Don't leak the mapping handle from cdb_init by
 	using the saved one.  Fixes bug#1010.
 
+src/
+2010-12-17 Werner Koch  <wk at g10code.com>
 
+        * crlcache.c (crl_cache_insert): Try to close unused but open
+        cache files.  Backported from GnuPG trunk.
+
+
 --- src/cdblib.c	(revision 345)
 +++ src/cdblib.c	(working copy)
 @@ -138,6 +138,7 @@
@@ -52,3 +58,40 @@
    const unsigned char *cdb_mem; /* mmap'ed file memory */
    cdbi_t cdb_vpos, cdb_vlen;	/* found data */
 
+
+--- src/crlcache.c~     2009-08-07 14:00:17.000000000 +0200
++++ src/crlcache.c      2010-12-17 16:42:13.000000000 +0100
+@@ -2166,6 +2166,32 @@ crl_cache_insert (ctrl_t ctrl, const cha
+   newfname = make_db_file_name (entry->issuer_hash);
+   if (opt.verbose)
+     log_info (_("creating cache file `%s'\n"), newfname);
++
++  /* Just in case close unused matching files.  Actually we need this
++     only under Windows but saving file descriptors is never bad.  */
++  {
++    int any;
++    do 
++      {
++        any = 0;
++        for (e = cache->entries; e; e = e->next)
++          if (!e->cdb_use_count && e->cdb
++              && !strcmp (e->issuer_hash, entry->issuer_hash))
++            {
++              int fd = cdb_fileno (e->cdb);
++              cdb_free (e->cdb);
++              xfree (e->cdb);
++              e->cdb = NULL;
++              if (close (fd))
++                log_error (_("error closing cache file: %s\n"),
++                           strerror(errno));
++              any = 1;
++              break;
++            }
++      }
++    while (any);
++  }
++
+ #ifdef HAVE_W32_SYSTEM
+   unlink (newfname);
+ #endif
+



More information about the Gpg4win-commits mailing list