]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Fix mail_storage_last_error_push/pop() to work with internal errors
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 24 May 2017 16:16:03 +0000 (19:16 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 24 May 2017 16:16:03 +0000 (19:16 +0300)
src/lib-storage/mail-storage-private.h
src/lib-storage/mail-storage.c

index 47ca36ac8835ea52d68e2823476c9c3a94ebef34..8dd9e11f7e686915e7e8435c8e39f554f7d2814e 100644 (file)
@@ -105,6 +105,8 @@ struct mail_binary_cache {
 struct mail_storage_error {
        char *error_string;
        enum mail_error error;
+       char *last_internal_error;
+       bool last_error_is_internal;
 };
 
 struct mail_storage {
index 835e9d9ea174f9a85f68030dc20a023003d3e623..0ba25436cad4f90f30fa6f3c13480efcaf4cb986 100644 (file)
@@ -657,6 +657,9 @@ void mail_storage_last_error_push(struct mail_storage *storage)
        err = array_append_space(&storage->error_stack);
        err->error_string = i_strdup(storage->error_string);
        err->error = storage->error;
+       err->last_error_is_internal = storage->last_error_is_internal;
+       if (err->last_error_is_internal)
+               err->last_internal_error = i_strdup(storage->last_internal_error);
 }
 
 void mail_storage_last_error_pop(struct mail_storage *storage)
@@ -666,8 +669,11 @@ void mail_storage_last_error_pop(struct mail_storage *storage)
                array_idx(&storage->error_stack, count-1);
 
        i_free(storage->error_string);
+       i_free(storage->last_internal_error);
        storage->error_string = err->error_string;
        storage->error = err->error;
+       storage->last_error_is_internal = err->last_error_is_internal;
+       storage->last_internal_error = err->last_internal_error;
        array_delete(&storage->error_stack, count-1, 1);
 }