Skip to content

Commit

Permalink
lib-index: Add mail_index_set_error_nolog()
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen committed Dec 25, 2017
1 parent 961a5c4 commit d808185
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib-index/mail-index-private.h
Expand Up @@ -338,8 +338,12 @@ void mail_index_view_transaction_unref(struct mail_index_view *view);

void mail_index_fsck_locked(struct mail_index *index);

/* Log an error and set it as the index's current error that is available
with mail_index_get_error_message(). */
void mail_index_set_error(struct mail_index *index, const char *fmt, ...)
ATTR_FORMAT(2, 3);
/* Same as mail_index_set_error(), but don't log the error. */
void mail_index_set_error_nolog(struct mail_index *index, const char *str);
/* "%s failed with index file %s: %m" */
void mail_index_set_syscall_error(struct mail_index *index,
const char *function);
Expand Down
9 changes: 9 additions & 0 deletions src/lib-index/mail-index.c
Expand Up @@ -915,6 +915,15 @@ void mail_index_set_error(struct mail_index *index, const char *fmt, ...)
}
}

void mail_index_set_error_nolog(struct mail_index *index, const char *str)
{
i_assert(str != NULL);

char *old_error = index->error;
index->error = i_strdup(str);
i_free(old_error);
}

bool mail_index_is_in_memory(struct mail_index *index)
{
return MAIL_INDEX_IS_IN_MEMORY(index);
Expand Down

0 comments on commit d808185

Please sign in to comment.