config_dump_full_callback, &dump_ctx);
}
i_zero(&empty_filter);
- config_export_by_filter(export_ctx, &empty_filter);
+ if (config_export_by_filter(export_ctx, &empty_filter) < 0) {
+ config_export_free(&export_ctx);
+ str_free(&dump_ctx.delayed_output);
+ return -1;
+ }
string_t *path = t_str_new(128);
const char *final_path = NULL;
struct config_module_parser *dup_parsers;
struct master_service_settings_output output;
unsigned int section_idx;
-
- bool failed;
};
static void config_export_size(string_t *str, uoff_t size)
return ctx;
}
-void config_export_by_filter(struct config_export_context *ctx,
- const struct config_filter *filter)
+int config_export_by_filter(struct config_export_context *ctx,
+ const struct config_filter *filter)
{
const char *error;
&ctx->dup_parsers, &ctx->output,
&error) < 0) {
i_error("%s", error);
- ctx->failed = TRUE;
+ return -1;
}
ctx->parsers = ctx->dup_parsers;
+ return 0;
}
void config_export_parsers(struct config_export_context *ctx,
*_ctx = NULL;
- if (ctx->failed) {
- config_export_free(&ctx);
- return -1;
- }
-
ctx->section_idx = *section_idx;
for (i = 0; ctx->parsers[i].root != NULL; i++) {
parser = &ctx->parsers[i];
enum config_dump_flags flags,
config_request_callback_t *callback, void *context)
ATTR_NULL(1, 5);
-void config_export_by_filter(struct config_export_context *ctx,
- const struct config_filter *filter);
+int config_export_by_filter(struct config_export_context *ctx,
+ const struct config_filter *filter);
void config_export_parsers(struct config_export_context *ctx,
const struct config_module_parser *parsers);
void config_export_get_output(struct config_export_context *ctx,
o_stream_cork(output);
ctx = config_dump_human_init(scope, TRUE);
- config_export_by_filter(ctx->export_ctx, filter);
- ret = config_dump_human_output(ctx, output, 0, setting_name_filter, hide_passwords);
+ if ((ret = config_export_by_filter(ctx->export_ctx, filter)) < 0)
+ config_export_free(&ctx->export_ctx);
+ else
+ ret = config_dump_human_output(ctx, output, 0, setting_name_filter, hide_passwords);
config_dump_human_deinit(ctx);
if (setting_name_filter == NULL)
bool dump_section = FALSE;
ctx = config_dump_human_init(scope, FALSE);
- config_export_by_filter(ctx->export_ctx, filter);
+ if (config_export_by_filter(ctx->export_ctx, filter) < 0) {
+ config_export_free(&ctx->export_ctx);
+ return -1;
+ }
if (config_export_all_parsers(&ctx->export_ctx, §ion_idx) < 0)
return -1;
CONFIG_DUMP_FLAG_CHECK_SETTINGS,
config_request_simple_stdout,
setting_name_filters);
- config_export_by_filter(ctx, &filter);
- ret2 = config_export_all_parsers(&ctx, §ion_idx);
+ if ((ret2 = config_export_by_filter(ctx, &filter)) < 0)
+ config_export_free(&ctx);
+ else
+ ret2 = config_export_all_parsers(&ctx, §ion_idx);
} else if (setting_name_filters != NULL) {
ret2 = 0;
/* ignore settings-check failures in configuration. this allows