changeset: 6575:aff8d62ebddb
user:      Kevin McCarthy <ke...@8t8.us>
date:      Wed Mar 16 13:33:55 2016 -0700
link:      http://dev.mutt.org/hg/mutt/rev/aff8d62ebddb

Fix crash in hcache_open_tc() when open fails and debug is on. (closes #3813)

When the hcache open fails, it was trying to dprint.  The dprint had a
%s where it was passing errno, leading to a crash in strlen.

Unify the dprint messages for tcdbopen and tcdbclose to report the
path, strerror, and errno.

Thanks to Will Yardley for capturing the stack trace!

diffs (21 lines):

diff -r 29b254ac7c12 -r aff8d62ebddb hcache.c
--- a/hcache.c  Tue Mar 15 18:04:26 2016 -0700
+++ b/hcache.c  Wed Mar 16 13:33:55 2016 -0700
@@ -931,7 +931,7 @@
     return 0;
   else
   {
-    dprint(2, (debugfile, "tcbdbopen %s failed: %s\n", path, errno));
+    dprint(2, (debugfile, "tcbdbopen failed for %s: %s (errno %d)\n", path, 
strerror (errno), errno));
     tcbdbdel(h->db);
     return -1;
   }
@@ -944,7 +944,7 @@
     return;
 
   if (!tcbdbclose(h->db))
-      dprint (2, (debugfile, "tcbdbclose failed for %s: %d\n", h->folder, 
errno));
+    dprint (2, (debugfile, "tcbdbclose failed for %s: %s (errno %d)\n", 
h->folder, strerror (errno), errno));
   tcbdbdel(h->db);
   FREE(&h->folder);
   FREE(&h);

Reply via email to