From 889a1aea939d53e11ba34a55f6280d53e42f1d24 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 29 Apr 2010 17:48:57 +0300 Subject: [PATCH] mdbox: Storage rebuild now silently ignores m.*.lock files if they exist. --HG-- branch : HEAD --- .../index/dbox-multi/mdbox-storage-rebuild.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c b/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c index f2a155714a..1acb9b9e99 100644 --- a/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c +++ b/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c @@ -214,8 +214,7 @@ static int rebuild_add_file(struct mdbox_storage_rebuild_context *ctx, { struct dbox_file *file; uint32_t file_id; - const char *fname; - unsigned int len; + const char *fname, *ext; bool deleted; int ret = 0; @@ -224,10 +223,13 @@ static int rebuild_add_file(struct mdbox_storage_rebuild_context *ctx, fname += strlen(MDBOX_MAIL_FILE_PREFIX) + 1; if (str_to_uint32(fname, &file_id) < 0 || file_id == 0) { - len = strlen(fname); - if (len > 7 && strcmp(fname + len - 7, ".broken") != 0) { - i_warning("dbox rebuild: File name is missing ID: %s", - path); + /* m.*.broken files are created by file fixing + m.*.lock files are created if flock() isn't available */ + ext = strrchr(fname, '.'); + if (ext == NULL || (strcmp(ext, ".broken") != 0 && + strcmp(ext, ".lock") != 0)) { + i_warning("dbox rebuild: " + "Skipping file with missing ID: %s", path); } return 0; } -- 2.47.3