From 5caa362b47a47226ad7fe4e8fa32b37afe7cd39f Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 29 Jun 2010 19:04:39 +0100 Subject: [PATCH] single-dbox: Fixed moving mails to alt storage. --HG-- branch : HEAD --- src/lib-storage/index/dbox-common/dbox-file.c | 1 - src/lib-storage/index/dbox-single/sdbox-sync-file.c | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/lib-storage/index/dbox-common/dbox-file.c b/src/lib-storage/index/dbox-common/dbox-file.c index fcdeed50ae..dacaf5c507 100644 --- a/src/lib-storage/index/dbox-common/dbox-file.c +++ b/src/lib-storage/index/dbox-common/dbox-file.c @@ -688,7 +688,6 @@ int dbox_file_move(struct dbox_file *file, bool alt_path) int out_fd, ret = 0; i_assert(file->input != NULL); - i_assert(file->lock != NULL); if (dbox_file_is_in_alt(file) == alt_path) return 0; diff --git a/src/lib-storage/index/dbox-single/sdbox-sync-file.c b/src/lib-storage/index/dbox-single/sdbox-sync-file.c index 22d1e225e8..d5fcd18fbb 100644 --- a/src/lib-storage/index/dbox-single/sdbox-sync-file.c +++ b/src/lib-storage/index/dbox-single/sdbox-sync-file.c @@ -17,14 +17,13 @@ dbox_sync_file_move_if_needed(struct dbox_file *file, enum sdbox_sync_entry_type type) { bool move_to_alt = type == SDBOX_SYNC_ENTRY_TYPE_MOVE_TO_ALT; - + bool deleted; + if (move_to_alt != dbox_file_is_in_alt(file)) { /* move the file. if it fails, nothing broke so don't worry about it. */ - if (dbox_file_try_lock(file) > 0) { + if (dbox_file_open(file, &deleted) > 0 && !deleted) (void)dbox_file_move(file, move_to_alt); - dbox_file_unlock(file); - } } } -- 2.47.3