From 6b88b35aa0d6edbcb530bc737f33356589f17996 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sun, 27 Sep 2015 21:48:34 +0300 Subject: [PATCH] push-notification: Log about unexpectedly failing mailbox functions. Found by Coverity. --- .../push-notification/push-notification-driver-ox.c | 6 +++++- .../push-notification-event-mailboxcreate.c | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/plugins/push-notification/push-notification-driver-ox.c b/src/plugins/push-notification/push-notification-driver-ox.c index 31ec603de9..caaf8f73d1 100644 --- a/src/plugins/push-notification/push-notification-driver-ox.c +++ b/src/plugins/push-notification/push-notification-driver-ox.c @@ -128,7 +128,11 @@ static const char *push_notification_driver_ox_get_metadata 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 --git a/src/plugins/push-notification/push-notification-event-mailboxcreate.c b/src/plugins/push-notification/push-notification-event-mailboxcreate.c index ef5c37c7db..615dc9816a 100644 --- a/src/plugins/push-notification/push-notification-event-mailboxcreate.c +++ b/src/plugins/push-notification/push-notification-event-mailboxcreate.c @@ -26,7 +26,12 @@ static void push_notification_event_mailboxcreate_event( 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); -- 2.47.3