changeset: 6576:cc1af19c0763
user:      Kevin McCarthy <[email protected]>
date:      Wed Mar 16 14:15:14 2016 -0700
link:      http://dev.mutt.org/hg/mutt/rev/cc1af19c0763

Fix tcbdb error reporting to use ecode, not errno.

After committing aff8d62ebddb and taking a closer look at the tcbdb
documentation, I realized those functions don't set errno.

Change the error handling messages to instead get the ecode and
message using tcbdbecode() and tcbdberrmsg().

diffs (25 lines):

diff -r aff8d62ebddb -r cc1af19c0763 hcache.c
--- a/hcache.c  Wed Mar 16 13:33:55 2016 -0700
+++ b/hcache.c  Wed Mar 16 14:15:14 2016 -0700
@@ -931,7 +931,8 @@
     return 0;
   else
   {
-    dprint(2, (debugfile, "tcbdbopen failed for %s: %s (errno %d)\n", path, 
strerror (errno), errno));
+    int ecode = tcbdbecode (h->db);
+    dprint (2, (debugfile, "tcbdbopen failed for %s: %s (ecode %d)\n", path, 
tcbdberrmsg (ecode), ecode));
     tcbdbdel(h->db);
     return -1;
   }
@@ -944,7 +945,10 @@
     return;
 
   if (!tcbdbclose(h->db))
-    dprint (2, (debugfile, "tcbdbclose failed for %s: %s (errno %d)\n", 
h->folder, strerror (errno), errno));
+  {
+    int ecode = tcbdbecode (h->db);
+    dprint (2, (debugfile, "tcbdbclose failed for %s: %s (ecode %d)\n", 
h->folder, tcbdberrmsg (ecode), ecode));
+  }
   tcbdbdel(h->db);
   FREE(&h->folder);
   FREE(&h);

Reply via email to