diff src/lib-storage/index/dbox-single/sdbox-sync.c @ 14048:fb659472b2a2

sdbox: Fixed moving files from alt storage to primary storage.
author Timo Sirainen <tss@iki.fi>
date Wed, 01 Feb 2012 23:33:51 +0200
parents 1e118913348b
children ba770cba5598
line wrap: on
line diff
--- a/src/lib-storage/index/dbox-single/sdbox-sync.c	Wed Feb 01 23:06:12 2012 +0200
+++ b/src/lib-storage/index/dbox-single/sdbox-sync.c	Wed Feb 01 23:33:51 2012 +0200
@@ -12,9 +12,17 @@
 dbox_sync_file_move_if_needed(struct dbox_file *file,
 			      enum sdbox_sync_entry_type type)
 {
+	struct stat st;
 	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_to_alt) {
+		/* unopened dbox files default to primary dir.
+		   stat the file to update its location. */
+		(void)dbox_file_stat(file, &st);
+
+	}
 	if (move_to_alt != dbox_file_is_in_alt(file)) {
 		/* move the file. if it fails, nothing broke so
 		   don't worry about it. */