Mercurial > dovecot > core-2.2
changeset 4296:e4650b4f4e5a HEAD
Close index files before trying to unlink the index directory
author | Timo Sirainen <timo.sirainen@movial.fi> |
---|---|
date | Wed, 31 May 2006 16:17:49 +0300 |
parents | 4fc637010202 |
children | 339ca5b4a3f2 |
files | src/lib-storage/index/dbox/dbox-storage.c src/lib-storage/index/maildir/maildir-storage.c |
diffstat | 2 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/dbox/dbox-storage.c Wed May 31 14:03:53 2006 +0300 +++ b/src/lib-storage/index/dbox/dbox-storage.c Wed May 31 16:17:49 2006 +0300 @@ -488,6 +488,10 @@ return -1; } + /* make sure the indexes are closed before trying to delete the + directory that contains them */ + index_storage_destroy_unrefed(); + if (unlink_directory(mail_path, TRUE) < 0) { if (!dbox_handle_errors(istorage)) { mail_storage_set_critical(_storage,
--- a/src/lib-storage/index/maildir/maildir-storage.c Wed May 31 14:03:53 2006 +0300 +++ b/src/lib-storage/index/maildir/maildir-storage.c Wed May 31 16:17:49 2006 +0300 @@ -641,14 +641,16 @@ return -1; } + /* Make sure the indexes are closed before trying to delete the + directory that contains them. It can still fail with some NFS + implementations if indexes are opened by another session, but + can't really help that. */ + index_storage_destroy_unrefed(); + if (storage->index_dir != NULL && *name != '/' && *name != '~' && strcmp(storage->index_dir, storage->dir) != 0) { index_dir = t_strconcat(storage->index_dir, "/"MAILDIR_FS_SEP_S, name, NULL); - index_storage_destroy_unrefed(); - - /* it can fail with some NFS implementations if indexes are - opened by another session.. can't really help it. */ if (unlink_directory(index_dir, TRUE) < 0 && errno != ENOTEMPTY) { mail_storage_set_critical(_storage,