comparison src/lib-storage/index/dbox-common/dbox-sync-rebuild.c @ 15095:89c319980584

dbox: Renamed dbox_sync_rebuild_verify_alt_storage() to dbox_verify_alt_storage()
author Timo Sirainen <tss@iki.fi>
date Tue, 25 Sep 2012 17:31:15 +0300
parents d0d7b810646b
children
comparison
equal deleted inserted replaced
15094:200ec10b2314 15095:89c319980584
199 mail_index_close(ctx->backup_index); 199 mail_index_close(ctx->backup_index);
200 mail_index_free(&ctx->backup_index); 200 mail_index_free(&ctx->backup_index);
201 } 201 }
202 i_free(ctx); 202 i_free(ctx);
203 } 203 }
204
205 int dbox_sync_rebuild_verify_alt_storage(struct mailbox_list *list)
206 {
207 const char *alt_path, *error;
208 struct stat st;
209
210 alt_path = mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_ALT_DIR);
211 if (alt_path == NULL)
212 return 0;
213
214 /* make sure alt storage is mounted. if it's not, abort the rebuild. */
215 if (stat(alt_path, &st) == 0)
216 return 0;
217 if (errno != ENOENT) {
218 i_error("stat(%s) failed: %m", alt_path);
219 return -1;
220 }
221
222 /* try to create the alt directory. if it fails, it means alt
223 storage isn't mounted. */
224 if (mailbox_list_mkdir_root(list, alt_path,
225 MAILBOX_LIST_PATH_TYPE_ALT_DIR,
226 &error) < 0) {
227 i_error("Couldn't create dbox alt root dir %s: %s",
228 alt_path, error);
229 return -1;
230 }
231 return 0;
232 }