if (ret <= 0)
ret = -1;
- else {
+ else if (ctx->append_ctx == NULL) {
+ /* everything purged from this file */
+ ret = 1;
+ } else {
/* assign new file_id + offset to moved messages */
if (dbox_map_append_move(ctx->append_ctx, &copied_map_uids,
&expunged_map_uids) < 0 ||
dbox_map_append_commit(ctx->append_ctx) < 0)
ret = -1;
- else {
+ else
ret = 1;
- (void)dbox_file_unlink(file);
- }
}
- dbox_map_append_free(&ctx->append_ctx);
+ if (ret > 0)
+ (void)dbox_file_unlink(file);
+ if (ctx->append_ctx != NULL)
+ dbox_map_append_free(&ctx->append_ctx);
if (ret < 0)
dbox_file_unlock(file);
array_free(&copied_map_uids);
return -1;
}
-#ifndef HAVE_FLOCK
- if (master_service_get_client_limit(master_service) > 1) {
- *error_r = "mdbox requires client_limit=1 for service "
- "since your OS doesn't support flock()";
- return -1;
- }
-#endif
-
_storage->unique_root_dir =
p_strdup(_storage->pool, ns->list->set.root_dir);