Mercurial > dovecot > core
changeset 26747:7ea9b78f93e7
lib-fs: Log any pending errors in fs_file_deinit()
If error was set to the file but it wasn't accessed with
fs_file_last_error(), it means the error message would become lost.
Usually this is probably not intended.
author | Timo Sirainen <timo.sirainen@open-xchange.com> |
---|---|
date | Fri, 29 Nov 2019 17:49:23 +0200 |
parents | 549e8b3d4441 |
children | 09d8fcdc8604 |
files | src/lib-fs/fs-api.c |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-fs/fs-api.c Fri Nov 29 17:11:15 2019 +0200 +++ b/src/lib-fs/fs-api.c Fri Nov 29 17:49:23 2019 +0200 @@ -306,6 +306,14 @@ void fs_file_free(struct fs_file *file) { + if (file->last_error_changed) { + /* fs_set_error() used without ever accessing it via + fs_file_last_error(). Log it to make sure it's not lost. + Note that the errors are always set only to the file at + the root of the parent hierarchy. */ + e_error(file->event, "%s (in file deinit)", file->last_error); + } + fs_file_deinit(&file->parent); event_unref(&file->event); pool_unref(&file->metadata_pool);