dovecot-2.2: push-notification: Log about unexpectedly failing m...

dovecot at dovecot.org dovecot at dovecot.org
Sun Sep 27 18:51:03 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/30f4615efa10
changeset: 19231:30f4615efa10
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Sep 27 21:48:34 2015 +0300
description:
push-notification: Log about unexpectedly failing mailbox functions.
Found by Coverity.

diffstat:

 src/plugins/push-notification/push-notification-driver-ox.c           |  6 +++++-
 src/plugins/push-notification/push-notification-event-mailboxcreate.c |  7 ++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diffs (33 lines):

diff -r 8d2f1c363853 -r 30f4615efa10 src/plugins/push-notification/push-notification-driver-ox.c
--- a/src/plugins/push-notification/push-notification-driver-ox.c	Sun Sep 27 21:42:17 2015 +0300
+++ b/src/plugins/push-notification/push-notification-driver-ox.c	Sun Sep 27 21:48:34 2015 +0300
@@ -128,7 +128,11 @@
             success = TRUE;
         }
 
-        mailbox_transaction_commit(&mctx);
+        if (mailbox_transaction_commit(&mctx) < 0) {
+            i_error(OX_LOG_LABEL "Transaction commit failed: %s",
+                    mailbox_get_last_error(inbox, NULL));
+            /* the commit doesn't matter though. */
+        }
     }
 
     mailbox_free(&inbox);
diff -r 8d2f1c363853 -r 30f4615efa10 src/plugins/push-notification/push-notification-event-mailboxcreate.c
--- a/src/plugins/push-notification/push-notification-event-mailboxcreate.c	Sun Sep 27 21:42:17 2015 +0300
+++ b/src/plugins/push-notification/push-notification-event-mailboxcreate.c	Sun Sep 27 21:48:34 2015 +0300
@@ -26,7 +26,12 @@
     struct push_notification_event_mailboxcreate_data *data;
     struct mailbox_status status;
 
-    mailbox_get_status(ptxn->mbox, STATUS_UIDVALIDITY, &status);
+    if (mailbox_get_status(ptxn->mbox, STATUS_UIDVALIDITY, &status) < 0) {
+        i_error(EVENT_NAME "Failed to get created mailbox '%s' uidvalidity: %s",
+                mailbox_get_vname(ptxn->mbox),
+                mailbox_get_last_error(ptxn->mbox, NULL));
+        status.uidvalidity = 0;
+    }
 
     data = p_new(ptxn->pool,
                  struct push_notification_event_mailboxcreate_data, 1);


More information about the dovecot-cvs mailing list